Skip to content

Commit 885e342

Browse files
authored
Update js codes.docx
1 parent 8cc7357 commit 885e342

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

js codes.docx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)