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

Function reverseLinkedlist

python/Chapter 2/Question2_5.py:80–86  ·  view source on GitHub ↗
(linkedlist)

Source from the content-addressed store, hash-verified

78
79# Helper function to create a reversed linedlist
80def reverseLinkedlist(linkedlist):
81 current = linkedlist.head
82 newlinkedlist = LinkedList()
83 while current != None:
84 addNodeInFront(newlinkedlist, current.value)
85 current = current.next
86 return newlinkedlist
87
88
89# Helper function to caculate length of a linked list

Callers 1

addLists_fwdFunction · 0.85

Calls 2

addNodeInFrontFunction · 0.85
LinkedListClass · 0.50

Tested by

no test coverage detected