Discussion Attendance

Question 1

  1. Draw the box-and-pointer diagram for the linked list link after the following code is executed.
>>> link = Link(0)
for i in range(1, 3):
... link = Link(i, Link(link, link))
...
>>> link.rest.rest.rest = link.rest

Question 2

Write a function all_paths that takes in a Tree and returns a list of paths from the root to leaves. Each path is represented as a Link.

def all_paths(tree):
    """YOUR CODE HERE."""