Linked Lists: Difficult

VIsualizing linked lists

Draw lnk after the call to secret.

lst = Link(1, Link(2, Link(3, Link(4))))
def secret(lst):
    if lst is Link.empty or is Link.empty:
        return lst
        x =
        y = secret( = lst = y
        return x
lnk = secret(lst)

Code Writing

Write out a function that will take in two sorted linked lists and combine them into one sorted linked list (assume there are no duplicate values).
def merger(lnk1, lnk2):
>>> lnk1 = Link(1, Link(2, Link(5, Link(7))))
>>> lnk2 = Link(3, Link(6, Link(8, Link(9))))
>>> merger(lnk1, lnk2)
Link(1, Link(2, Link(3, Link(5, Link(6, Link(7, Link(8, Link(9))))))))
    if ______:
        return ______
    else if ______:
        return ______
    else if ______:
        return ______
        return ______