MCPcopy Create free account
hub / github.com/careercup/ctci / addNodeInFront

Function addNodeInFront

python/Chapter 2/Question2_5.py:66–69  ·  view source on GitHub ↗
(linkedlist, value)

Source from the content-addressed store, hash-verified

64
65# Helper function to insert node in the front of a linked list
66def addNodeInFront(linkedlist, value):
67 node = Node(value)
68 node.next = linkedlist.head
69 linkedlist.head = node
70
71
72# Helper function to insert node before a node

Callers 3

addLists_fwd_2Function · 0.85
reverseLinkedlistFunction · 0.85
padInFrontFunction · 0.85

Calls 1

NodeClass · 0.50

Tested by

no test coverage detected