Copy and Paste  -   An Application to Copy/Paste Text  

 
S.No 4814 Name code Date/Time 21-Apr-2022 12:19:57 PM

Copy text from below

# Python program for implementation of MergeSort

def mergeSort(arr):

if len(arr) > 1:

 

# Finding the mid of the array

mid = len(arr)//2

 

# Dividing the array elements

L = arr[:mid]

 

# into 2 halves

R = arr[mid:]

 

# Sorting the first half

mergeSort(L)

 

# Sorting the second half

mergeSort(R)

 

i = j = k = 0

 

# Copy data to temp arrays L[] and R[]

while i < len(L) and j < len(R):

if L[i] < R[j]:

arr[k] = L[i]

i += 1

else:

arr[k] = R[j]

j += 1

k += 1

 

# Checking if any element was left

while i < len(L):

arr[k] = L[i]

i += 1

k += 1

 

while j < len(R):

arr[k] = R[j]

j += 1

k += 1

 

# Code to print the list

 

 

def printList(arr):

for i in range(len(arr)):

print(arr[i], end=" ")

print()

 

 

# Driver Code

if __name__ == '__main__':

arr = [12, 11, 13, 5, 6, 7]

print("Given array is", end="\n")

printList(arr)

mergeSort(arr)

print("Sorted array is: ", end="\n")

printList(arr)

 

# This code is contributed by Mayank Khanna

 





comments powered by Disqus
NEW ENTRIES
S.No Name Entry Time/Date
4807 A 16-Apr-2022 11:14:41 AM
4806 F 15-Apr-2022 10:24:54 AM
4805 Link 12-Apr-2022 01:50:28 PM
4804 Shahbaz 12-Apr-2022 10:30:11 AM
4803 11-Apr-2022 08:13:42 PM
4802 Robert 07-Apr-2022 02:29:12 AM
4801 02-Apr-2022 11:49:42 PM
4800 Family Sexy 31-Mar-2022 07:53:45 AM
4799 28-Mar-2022 11:11:51 AM
4798 SexyFun 28-Mar-2022 09:30:25 AM
4797 25-Mar-2022 04:42:56 PM
4796 24-Mar-2022 10:09:53 AM
4795 New Videos 24-Mar-2022 09:00:17 AM
4794 22-Mar-2022 02:44:38 PM
4793 New Hot 21-Mar-2022 09:52:17 AM
4792 Bollywood 18-Mar-2022 08:52:26 AM
4791 16-Mar-2022 08:48:38 AM
4790 New H0t 14-Mar-2022 10:11:49 AM
4789 11-Mar-2022 12:03:01 PM
4788 H0t Videos 10-Mar-2022 08:46:13 AM
4787 09-Mar-2022 05:27:45 PM
4786 Sexy Hottest 08-Mar-2022 08:28:46 AM
4785 app 07-Mar-2022 06:57:11 PM
4784 Girls Boys 05-Mar-2022 08:41:23 AM
4783 SexyVideos 02-Mar-2022 09:24:48 AM
4782 NewSexy Vid 21-Feb-2022 10:17:49 AM
4781 while loop 20-Feb-2022 08:45:58 PM
4780 pile 19-Feb-2022 10:28:13 PM
4779 pydev 19-Feb-2022 07:56:41 PM
4778 . 19-Feb-2022 02:31:43 PM

[First] [Prev] 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 [Next] [Last]
 
web counter
web counter


To report any error messages or bugs, or other issues, please send email at: info@pakproject.com