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
4687 aaaa 29-Oct-2021 05:12:33 PM
4686 Seller 27-Oct-2021 03:49:45 PM
4685 aa 26-Oct-2021 11:24:33 AM
4684 hello 22-Oct-2021 05:03:30 PM
4683 App5 14-Oct-2021 02:18:47 PM
4682 App4 14-Oct-2021 02:02:59 PM
4681 aaa 14-Oct-2021 01:59:30 PM
4680 App3 14-Oct-2021 01:57:54 PM
4679 App2 14-Oct-2021 01:54:42 PM
4678 20000 14-Oct-2021 01:51:36 PM
4677 App1 14-Oct-2021 01:50:41 PM
4676 LinkedIn 11-Oct-2021 07:24:01 AM
4675 apk 11-Oct-2021 12:23:07 AM
4674 Free ui ecom 09-Oct-2021 03:06:00 AM
4673 Namrah 08-Oct-2021 05:25:17 PM
4672 shawal 08-Oct-2021 04:34:27 PM
4671 asp.ner core 08-Oct-2021 12:01:38 PM
4670 Hh 07-Oct-2021 10:20:05 AM
4669 ss 03-Oct-2021 01:45:40 PM
4668 assignment 29-Sep-2021 03:39:37 PM
4667 pwd 28-Sep-2021 09:14:58 AM
4666 hmm 27-Sep-2021 09:37:34 PM
4665 osman 27-Sep-2021 12:57:48 AM
4663 Muzamil 23-Sep-2021 05:12:29 PM
4662 CSE 21 20-Sep-2021 02:35:32 PM
4661 CSS 21 20-Sep-2021 02:34:50 PM
4659 CSP 21 20-Sep-2021 02:33:21 PM
4658 Eng 21 20-Sep-2021 02:32:44 PM
4657 Medical 21 20-Sep-2021 02:32:06 PM
4656 MED 19-Sep-2021 07:57:32 AM

[First] [Prev] 11 | 12 | 13 [Next] [Last]
 
web counter
web counter


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