更新时间:2023-11-10 11:34:04
定义:
一个多链表是一个链表,其中每个节点都可以包含指向链表中多个节点的指针。
A multi linked list is a linked list where each node may contain pointers to more than one nodes of the linked list.
双向链接列表是多链接列表的特例。它有两种特殊的用法:
Doubly linked lists are a special case of Multi-linked lists. It is special in two ways:
每个节点只有2个指针。
Each node has just 2 pointers.
指针是彼此的精确逆。
示例:
一个多链表:
双向链接列表:
表示形式:
多链表:
typedef struct node
{
int data;
vector<struct node *> pointers;
}Node;
双向链表:
typedef struct node
{
int data;
struct node* prev;
struct node* next;
}Node;