MCPcopy Index your code
hub / github.com/careercup/ctci / padList

Method padList

java/Chapter 2/Question2_5/QuestionB.java:43–52  ·  view source on GitHub ↗
(LinkedListNode l, int padding)

Source from the content-addressed store, hash-verified

41 }
42
43 private static LinkedListNode padList(LinkedListNode l, int padding) {
44 LinkedListNode head = l;
45 for (int i = 0; i < padding; i++) {
46 LinkedListNode n = new LinkedListNode(0, null, null);
47 head.prev = n;
48 n.next = head;
49 head = n;
50 }
51 return head;
52 }
53
54 private static LinkedListNode insertBefore(LinkedListNode list, int data) {
55 LinkedListNode node = new LinkedListNode(data, null, null);

Callers 1

addListsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected