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
4747 Massage Body 19-Jan-2022 09:51:39 AM
4746 Updated S3xy 17-Jan-2022 12:30:31 PM
4745 . 16-Jan-2022 10:51:56 PM
4744 16-Jan-2022 10:51:13 PM
4743 She Video 12-Jan-2022 07:17:23 AM
4742 Hot Videos 10-Jan-2022 11:34:57 AM
4741 09-Jan-2022 07:57:39 PM
4740 09-Jan-2022 07:56:05 PM
4739 Pinoy Hot 08-Jan-2022 09:25:19 AM
4738 Sexxy Girls 06-Jan-2022 10:15:17 AM
4737 table 04-Jan-2022 09:07:21 PM
4736 . 04-Jan-2022 11:14:01 AM
4735 Ryan Millar 31-Dec-2021 01:02:32 PM
4734 Moissanite.c 30-Dec-2021 03:58:09 PM
4733 29-Dec-2021 06:10:39 PM
4732 dropdown 28-Dec-2021 06:01:49 PM
4731 database 28-Dec-2021 05:09:53 PM
4730 labtask 28-Dec-2021 02:57:46 PM
4729 aa 23-Dec-2021 09:19:21 PM
4728 saad 23-Dec-2021 05:59:00 PM
4727 saad 23-Dec-2021 05:46:24 PM
4726 maaz 23-Dec-2021 05:44:59 PM
4725 Squeaky Clea 19-Dec-2021 02:34:02 PM
4724 Squeaky Clea 19-Dec-2021 02:33:17 PM
4723 Squeaky Clea 19-Dec-2021 10:56:49 AM
4722 Isra 18-Dec-2021 08:06:47 PM
4721 q7 18-Dec-2021 02:33:26 PM
4720 q6 18-Dec-2021 02:30:10 PM
4719 q5 18-Dec-2021 02:26:21 PM
4718 q4 18-Dec-2021 02:17:30 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