Data Structures: Work with Nodes in a Linked List
This commit is contained in:
parent
05f2708e42
commit
e33373fa00
15
Data Structures/linkedList.js
Normal file
15
Data Structures/linkedList.js
Normal file
@ -0,0 +1,15 @@
|
||||
// https://www.freecodecamp.org/learn/coding-interview-prep/data-structures/work-with-nodes-in-a-linked-list
|
||||
|
||||
var Node = function (element) {
|
||||
this.element = element;
|
||||
this.next = null;
|
||||
};
|
||||
var Kitten = new Node("Kitten");
|
||||
var Puppy = new Node("Puppy");
|
||||
|
||||
Kitten.next = Puppy;
|
||||
// Only change code below this line
|
||||
const Cat = new Node("Cat");
|
||||
Puppy.next = Cat;
|
||||
const Dog = new Node("Dog");
|
||||
Cat.next = Dog;
|
Loading…
Reference in New Issue
Block a user