Skip to content

Instantly share code, notes, and snippets.

@alexnikol

alexnikol/.py

Last active Aug 10, 2020
Embed
What would you like to do?
Insert a Node at the Tail of a Linked List. Realization
from linked_list import SinglyLinkedListNode
def insertNodeAtTail(head, data):
if head is None:
return SinglyLinkedListNode(data)
else:
current_node = head
while current_node.next is not None:
current_node = current_node.next
current_node.next = SinglyLinkedListNode(data)
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.