Skip to content

Instantly share code, notes, and snippets.

View NellMartinez's full-sized avatar
🎯
Focusing

Nelitza Martinez NellMartinez

🎯
Focusing
View GitHub Profile
@NellMartinez
NellMartinez / Append_linked_list.py
Last active December 29, 2021 23:29
Append to a single linked list in constant time
def create_linked_list_better(input_list):
head = None
tail = None
for value in input_list:
if head is None:
head = Node(value)
tail = head # when we only have 1 node, head and tail refer to the same node