Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Created June 17, 2020 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vamsitallapudi/183ffce31ddb8b39ce35300b4b4a5941 to your computer and use it in GitHub Desktop.
Save vamsitallapudi/183ffce31ddb8b39ce35300b4b4a5941 to your computer and use it in GitHub Desktop.
def insert_at_end(head, data):
new_node = Node(data)
current = head
while current.next: # traversing till the last node
current = current.next
# change the next of last node
current.next = new_node
return head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment