Singly Linked Lists
class Nodes {
val: string;
next: null | Nodes;
constructor(val) {
this.val = val;
this.next = null;
}
}
class SinglyList {
head: Nodes | null;
tail: Nodes | null;
length: number;
constructor() {
this.head = null;
this.tail = null;
this.length = 0;
}
}
const item = new SinglyList();Push
Pop
Last updated