数据结构
链表
class LinkedListNode {
value: any;
next: LinkedListNode | null;
constructor(value, next) {
this.value = value;
this.next = next ?? null;
}
}
双向链表
class LinkedListNode {
value: any;
next: LinkedListNode | null;
constructor(value, next) {
this.value = value;
this.next = next ?? null;
next.prev = this;
}
}