-
-
Save alexnikol/3d2ad9967805a04b0d585dc68e77b017 to your computer and use it in GitHub Desktop.
Insert a node at the head of a linked list. Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RESULT | |
node1 = SinglyLinkedListNode(1) | |
node2 = SinglyLinkedListNode(2) | |
node3 = SinglyLinkedListNode(3) | |
node1.next = node2 | |
node2.next = node3 | |
result = insertNodeAtHead(node1, 33) | |
current_node = result | |
while current_node is not None: | |
print(current_node.data) | |
current_node = current_node.next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment