I have two ordered lists without duplicates. I need to create a third one in the most efficient way possible but I'm stuck. I could do it like this:
list1.extend(list2)
list1.sort(key=lambda x: x.id)
but I don't think this is efficient at all considering that both of the lists are already ordered. Do you have any suggestions on how to do it efficently?
Example:
list1 = [[40, 1980], [50, 1970], [70, 1980], [90, 1975]]
list2 = [[60, 1980],[65,1985]]
list3 = [[40, 1980],[50, 1970],[60, 1980],[65, 1985],[70, 1980],[90, 1975]]
PS: to the order the only thing that matters is the first variable which is 'id'