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
4837 HotSexyVideo 25-May-2022 08:54:30 AM
4836 22-May-2022 12:10:59 PM
4835 Boys Girls 21-May-2022 10:52:27 AM
4834 camera 14-May-2022 06:03:11 PM
4833 Gsgs 12-May-2022 02:58:03 PM
4832 tutorial 11-May-2022 09:48:47 PM
4831 BoyGirls Vid 10-May-2022 10:47:13 AM
4830 tuto 08-May-2022 07:49:22 PM
4829 stream 06-May-2022 10:36:34 AM
4828 camera1 05-May-2022 04:55:12 PM
4827 05-May-2022 04:54:33 PM
4826 camera 05-May-2022 04:53:56 PM
4825 02-May-2022 03:51:40 PM
4824 02-May-2022 03:51:21 PM
4823 02-May-2022 03:50:56 PM
4822 ffss 01-May-2022 11:23:29 AM
4821 motion.conf 01-May-2022 11:20:30 AM
4820 relay code 22-Apr-2022 08:59:17 PM
4819 pile 21-Apr-2022 11:03:42 PM
4818 servo 2 21-Apr-2022 08:35:01 PM
4817 servo 21-Apr-2022 03:39:46 PM
4816 asgn2 21-Apr-2022 12:23:37 PM
4815 aa 21-Apr-2022 12:20:58 PM
4814 code 21-Apr-2022 12:19:57 PM
4813 osman 21-Apr-2022 12:17:46 PM
4812 ralay 18-Apr-2022 08:15:33 PM
4811 link 18-Apr-2022 01:59:33 PM
4810 pins 17-Apr-2022 01:34:20 PM
4809 LIVE Stream 17-Apr-2022 10:28:31 AM
4808 link 16-Apr-2022 08:09:47 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