We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d671a7 commit c828f9bCopy full SHA for c828f9b
data-structure/linked-list/linked-list.js
@@ -0,0 +1,27 @@
1
+// this file for linked-list implementation
2
+
3
+class LinkedNode {
4
+ constructor(data, next = null, head) {
5
+ this.data =data;
6
+ this.next = next;
7
+ this.head = head;
8
+ }
9
+ allNextNode =()=> {
10
+ let nextNode = this;
11
+ do {
12
+ console.log(nextNode.data);
13
+ nextNode = nextNode.next;
14
+ } while (nextNode.next);
15
16
17
+}
18
19
+// testing ;
20
+function testLinkedList() {
21
+ const three = new LinkedNode(4,false ,false);
22
+ const two = new LinkedNode(3,three ,false);
23
+ const one = new LinkedNode(2,two ,false);
24
+ const head = new LinkedNode(1,one,true);
25
+ head.allNextNode();
26
27
+testLinkedList();
0 commit comments