Answers for "merge sort of two list in python"

2

sort two lists by one python

list1 = [3,2,4,1,1]
list2 = ['three', 'two', 'four', 'one', 'one2']
list1, list2 = zip(*sorted(zip(list1, list2)))
Posted by: Guest on October-15-2020
0

merge sort of two list in python

a=[2,4,1,4]
b=[0,2,3,4]
a.extend(b)
a.sort()
print(a)
Posted by: Guest on September-13-2021
-1

merge two sorted lists python

from heapq import merge 
  
# initializing lists 
test_list1 = [1, 5, 6, 9, 11] 
test_list2 = [3, 4, 7, 8, 10] 
  
# printing original lists  
print ("The original list 1 is : " + str(test_list1)) 
print ("The original list 2 is : " + str(test_list2)) 
  
# using heapq.merge() 
# to combine two sorted lists 
res = list(merge(test_list1, test_list2)) 
  
# printing result 
print ("The combined sorted list is : " + str(res))
Posted by: Guest on June-18-2020
-2

merge two sorted list in python

# l1 and l2 are lists
sorted(l1+l2)
Posted by: Guest on July-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language