filmov
tv
Merge Sort Using Python | Tamil | Quick Through | #PythonProgramming #AnnaUniversity #QuickThrough

Показать описание
Hello Guys!
In this Video, we going to
do merge sort in Python
Video Language:- Tamil
----------------------------------
ALGORITHM:
1.Create a function named mergesort
2. Find the mid of the list
3. Assign lefthalf = alist[:mid] and righthalf = alist[mid:]
4. Initialise i=j=k=0
5. while i (less than ) len(lefthalf) and j (less than) len(righthalf), perform the following
if lefthalf[i] (less than) righthalf[j]:
alist[k]=lefthalf[i]
Increment i
else
alist[k]=righthalf[j]
Increment j
Increment k
6. while i (less than) len(lefthalf),perform the following
alist[k]=lefthalf[i]
Increment i
Increment k
7. while j (less than) len(righthalf), perform the following
alist[k]=righthalf[j]
Increment j
Increment k
8. Print the sorted list
PROGRAM:
def mergeSort(alist):
print("Splitting ",alist)
if len(alist)(greater than)1:
mid = len(alist)//2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
a=[]
n=int(input('Enter upper limit:'))
for i in range(n):
#alist = [54,26,93,17,77,31,44,55,20]
mergeSort(a)
print(a)
-----------------------------------------------
keywords : How to find merge sort in python tamil
How to find merge sort in python in tamil, Merge sort in python tamil
anna university lab manual tamil python laboratory merge sort in python
quick through , quick through tamil .
----------------------------------------------
thanks for watching this guys ! and make sure to
subscribe this channel:)
In this Video, we going to
do merge sort in Python
Video Language:- Tamil
----------------------------------
ALGORITHM:
1.Create a function named mergesort
2. Find the mid of the list
3. Assign lefthalf = alist[:mid] and righthalf = alist[mid:]
4. Initialise i=j=k=0
5. while i (less than ) len(lefthalf) and j (less than) len(righthalf), perform the following
if lefthalf[i] (less than) righthalf[j]:
alist[k]=lefthalf[i]
Increment i
else
alist[k]=righthalf[j]
Increment j
Increment k
6. while i (less than) len(lefthalf),perform the following
alist[k]=lefthalf[i]
Increment i
Increment k
7. while j (less than) len(righthalf), perform the following
alist[k]=righthalf[j]
Increment j
Increment k
8. Print the sorted list
PROGRAM:
def mergeSort(alist):
print("Splitting ",alist)
if len(alist)(greater than)1:
mid = len(alist)//2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
a=[]
n=int(input('Enter upper limit:'))
for i in range(n):
#alist = [54,26,93,17,77,31,44,55,20]
mergeSort(a)
print(a)
-----------------------------------------------
keywords : How to find merge sort in python tamil
How to find merge sort in python in tamil, Merge sort in python tamil
anna university lab manual tamil python laboratory merge sort in python
quick through , quick through tamil .
----------------------------------------------
thanks for watching this guys ! and make sure to
subscribe this channel:)
Комментарии