Skip to content

Commit c1029e0

Browse files
committed
Fix Javascript algorithms
1 parent 38fc2b9 commit c1029e0

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

src/javascript/Deque.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Deque {
2929
}
3030
}
3131

32-
function main {
32+
function main() {
3333
let deque = new Deque();
3434

3535
deque.addFront(2);

src/javascript/DoublyLinkedList.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,17 @@ class DoublyLinkedList {
103103
}
104104
}
105105
}
106+
107+
function main() {
108+
let list = new DoublyLinkedList();
109+
110+
list.addToFront(2);
111+
list.addToFront(1);
112+
list.addToEnd(3);
113+
114+
list.readFromFront();
115+
list.remove(2);
116+
list.readFromEnd();
117+
}
118+
119+
main();

src/javascript/Stack.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,21 @@ class Stack {
1818
clear() {
1919
this.stack = [];
2020
}
21-
}
21+
}
22+
23+
function main() {
24+
let stack = new Stack();
25+
26+
stack.push(1);
27+
stack.push(2);
28+
stack.push(3);
29+
stack.read();
30+
31+
stack.pop();
32+
stack.read();
33+
34+
stack.clear();
35+
stack.read();
36+
}
37+
38+
main();

0 commit comments

Comments
 (0)