I'm doing some beginner python homework and this savage question comes all of a sudden, i've spent a good amount of time researching but I haven't found anything useful tho i feel the answer might be simpler then what've found so far. The excercise:
# Given two lists sorted in increasing order, create and
# return a merged list of all the elements in sorted order.
# You may modify the passed in lists.
# The solution should work in "linear" time, making a single
# pass of both lists.
# Hint: Don't use `sort` or `sorted` -- they are not O(n)
# linear time and the two lists are already provided in
# ascending sorted order.
If you could please throw in some documentation about the subject i'd appreciate it, thanks.
ibe the position in one list, andjthe position in the other. Both start at0. Every time you "take" an element, you increment the position. After you've reached the end of one list, you take everything from the other.