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
4717 q3 18-Dec-2021 02:17:14 PM
4716 a2 18-Dec-2021 01:57:57 PM
4715 azaz 18-Dec-2021 01:50:06 PM
4714 aa 17-Dec-2021 05:50:08 PM
4713 P 16-Dec-2021 12:09:01 PM
4712 16-Dec-2021 10:15:42 AM
4711 JSofShahbaz 15-Dec-2021 04:11:42 PM
4710 Shahbaz 15-Dec-2021 03:59:25 PM
4709 multi-cb 15-Dec-2021 11:05:56 AM
4708 multi_file_u 15-Dec-2021 11:00:13 AM
4707 fetchapi 14-Dec-2021 11:34:15 AM
4706 jimy 07-Dec-2021 04:32:44 PM
4705 html ,php 05-Dec-2021 10:57:44 AM
4704 Golston 03-Dec-2021 08:47:12 AM
4703 abbas 30-Nov-2021 11:04:10 PM
4702 a 30-Nov-2021 09:06:16 PM
4701 Calculator 30-Nov-2021 05:49:53 PM
4700 js calculato 30-Nov-2021 05:22:43 PM
4699 js_calc 30-Nov-2021 04:34:27 PM
4698 Nidascode 28-Nov-2021 12:31:34 AM
4697 Nida 27-Nov-2021 10:10:10 PM
4696 aasas 26-Nov-2021 04:14:17 PM
4695 form valid 23-Nov-2021 04:30:46 PM
4694 QUANTUMUNIVE 20-Nov-2021 11:53:26 AM
4693 Shahbaz 14-Nov-2021 11:27:23 AM
4692 azaz 13-Nov-2021 02:04:21 PM
4691 ABU 09-Nov-2021 08:43:25 PM
4690 name regex 09-Nov-2021 03:59:46 PM
4689 regexp 04-Nov-2021 04:21:36 PM
4688 asdf 29-Oct-2021 05:24:55 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