Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# insertion of new node at front of linked list
def insert_at_front(head, data):
# creating new node to be inserted
new_node = Node(data)
new_node.next = head # pointing the new node's next to head
head = new_node # making the new node as head
return head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.