Trying to understand Linked List from an undergrads perspective…
So what is a Linked List?
• A linked list is a linear collection of data elements, called nodes, each pointing to the next node by means of a pointer.
#linked list by constructor.
empty = []
def is_link(s):
return s == empty or (len(s) == 2 and is_link(s[1]))
def link(first, rest):
assert is_link(rest), "rest must be a linked list."
return [first, rest]
#Representation in Python using…