跳到主要内容

数据结构

链表

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;
}
}

二叉树