//节点类
class Node{
constructor(data){
this.data = data; //表示节点的数据域
this.prev = null; //指针域:指向当前节点的上一个节点
this.next = null; //指针域:指向当前节点的下一个节点
}
}
//双向链表类
class DoubleLinkList {
constructor() {
this.size = 0; //单链表的长度
this.head = new Node("head"); //表头节点
this.currNode = ''; //当前节点指针
}
//判断链表是否为空
isEmpty()
JavaScript 数据结构之双向链表
最新推荐文章于 2023-02-28 10:45:44 发布