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
4897 test 12 28 E 28-Jul-2022 10:59:40 AM
4896 test 11 28 E 28-Jul-2022 10:55:41 AM
4895 test 28-Jul-2022 10:55:15 AM
4894 test 8 28 Ev 28-Jul-2022 10:53:51 AM
4893 test 5 28 Ev 28-Jul-2022 10:39:27 AM
4892 test 4 28 Ev 28-Jul-2022 10:38:07 AM
4891 test 3 28 Ev 28-Jul-2022 10:32:47 AM
4890 test 2 28 Ev 28-Jul-2022 10:31:33 AM
4889 Test 1 28 Ev 28-Jul-2022 10:29:59 AM
4888 Update Kiddo 28-Jul-2022 07:56:17 AM
4887 27-Jul-2022 06:10:30 PM
4886 Test 12 28 M 27-Jul-2022 04:59:11 PM
4885 Test 11 28 M 27-Jul-2022 04:55:12 PM
4884 Test 8 28 M 27-Jul-2022 04:49:23 PM
4883 Test 5 28 M 27-Jul-2022 04:47:27 PM
4882 Test 4 28 M 27-Jul-2022 04:45:56 PM
4881 Test 3 28 M 27-Jul-2022 02:58:05 PM
4880 test 2 28 M 27-Jul-2022 02:50:57 PM
4879 test 1 28 M 27-Jul-2022 02:41:34 PM
4878 Junior H O T 27-Jul-2022 06:58:02 AM
4877 test 12 26 E 26-Jul-2022 11:19:44 AM
4876 test11 26 ev 26-Jul-2022 11:08:44 AM
4875 test 8 26 Ev 26-Jul-2022 11:06:18 AM
4874 test 6 26 ev 26-Jul-2022 10:51:04 AM
4873 test 5 26-Jul-2022 10:50:39 AM
4872 test 4 26 Ev 26-Jul-2022 10:49:16 AM
4871 test 3 26 ev 26-Jul-2022 10:44:51 AM
4870 test 2 26 ev 26-Jul-2022 10:41:19 AM
4869 test 1 26 ev 26-Jul-2022 10:40:02 AM
4868 test 2 Ev 26-Jul-2022 10:39:11 AM

[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