input [[1,4,5],[1,3,4],[2,6]]
output [1,1,2,3,4,4,5,6]
I have done a baby way by putting each value in to one process list which takes 2 loops and another loop for sorting
Is there any way to do it within O(n) or as fast as possible or not with using any function
def sortmerge(inputList):
processList = []
sortedList= []
for i in range(len(inputList)):
for j in range(len(inputList[i])):
processList.append(inputList[i][j])
# processList.sort()
while processList:
minimum = processList[0]
for x in processList:
if x < minimum:
minimum = x
sortedList.append(minimum)
processList.remove(minimum)
return sortedList