MCPcopy Create free account
hub / github.com/apna-college/Alpha / reverse

Method reverse

12_LinkedList.java/LinkedList.java:145–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 }
144
145 public void reverse() {//O(n)
146 Node prev = null;
147 Node curr = tail = head;
148 Node next;
149
150 while(curr != null) {
151 next = curr.next;
152 curr.next = prev;
153 prev = curr;
154 curr = next;
155 }
156 head = prev;
157 }
158
159 public void deleteNthfromEnd(int n) {
160 //calculate size

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected