We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e01c43 commit 59abeb1Copy full SHA for 59abeb1
src/_DataStructures_/LinkedList/index.js
@@ -156,6 +156,16 @@ class LinkedList {
156
this.tail = this.head;
157
this.size = 0;
158
}
159
+
160
+ traverseList() {
161
+ const arr = [];
162
+ let node = this.head;
163
+ while (node !== null) {
164
+ arr.push(node.data);
165
+ node = node.next;
166
+ }
167
+ return arr;
168
169
170
171
module.exports = { LinkedList, Node };
0 commit comments