File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3257,6 +3257,30 @@ else
32573257 "not anagram of each other");
32583258
32593259========================================================================================================================================================================
3260+ // How can you make a linkedlist nodes in javascript
3261+
3262+ class LinkedList {
3263+ constructor(data){
3264+ this.data = data;
3265+ this.next = null;
3266+ }
3267+ }
3268+
3269+ let head = new LinkedList(10);
3270+ let A = new LinkedList(20);
3271+ let B = new LinkedList(30);
3272+ let C = new LinkedList(40);
3273+ let D = new LinkedList(50);
3274+
3275+ head.next = A;
3276+ A.next = B;
3277+ B.next = C;
3278+ C.next = D;
3279+ D.next = A; //it will be circluar linked list
3280+ //D.next = null; //it will be single linked list
3281+
3282+ //output : 10 -> 20 -> 30 -> 40 -> Null
3283+ =======================================================================================================================================================================
32603284
32613285
32623286
You can’t perform that action at this time.
0 commit comments