MCPcopy Create free account
hub / github.com/careercup/CtCI-6th-Edition-JavaScript / append

Method append

chapter03/util/LinkedList.js:16–27  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

14 }
15
16 append(value) {
17 let node = new Node(value);
18 // if list is empty
19 if (!this.head) {
20 this.head = node;
21 this.tail = node;
22 }
23 else {
24 this.tail.next = node;
25 this.tail = node;
26 }
27 }
28
29 prepend(value) {
30 let node = new Node(value);

Callers 1

enqueueMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected