Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Created June 17, 2020 11:46
Show Gist options
  • Save vamsitallapudi/98ef4e1e1cea3fe200be6ae5c0a254f2 to your computer and use it in GitHub Desktop.
Save vamsitallapudi/98ef4e1e1cea3fe200be6ae5c0a254f2 to your computer and use it in GitHub Desktop.
# 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