跳到主要内容

资源 · 指南或文章

Doubly Linked List

讲解节点同时向前和向后链接的链表,以及为什么多出的这条链接让某些删除操作比单向链表更简单。

审核日期

打开原站: Doubly Linked List (在新标签页中打开原网站)

练习这个主题以 技术 / 编程 模式打开练习面试官,然后在那里选择题目。

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

Read this in other languages: Русский, 简体中文, 日本語, Português, 한국어, Español, Українська In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains two fields, called links, that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate the traversal of the list. If there is only one sentinel node, then the list is circularly linked via the sentinel node. It can be conceptualized as two singly linked lists formed from the same data items, but in opposite sequential orders. The two node links allow traversal of the list in either direction. While adding or removing a node in a doubly linked list requires changing more links than the same operations on a singly linked list, the operations are simpler and potentially more efficient (for nodes other than first nodes) because there is no need to keep track of the previous node during traversal or no need to traverse the list to find the previous node, so that its link can…

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • 定义,包括哨兵节点和循环变体
  • 在尾部追加以及按值删除的伪代码,涵盖头尾边界情况
  • 从尾部反向遍历的伪代码
  • 复杂度表:访问和查找 O(n),插入 O(1),删除 O(n),空间 O(n)

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

实现 Remove 伪代码,并测试四种情况:空链表、删除唯一的节点、删除尾节点以及删除中间节点。

范围与局限

页面上只有伪代码,没有练习或面试式题目。删除操作的复杂度假定需要先按值查找。

获取方式与形式

GitHub 上 trekhleb/javascript-algorithms(MIT)中的 README;附有另外七种语言译本的链接。英文,免费。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/data-structures/doubly-linked-list/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱