C / C ++中的双链表与多链表 [英] Doubly Linked list vs Multi-linked list in C/C++

查看:223
本文介绍了C / C ++中的双链表与多链表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

双向链表和多重链表之间有什么区别?
在C / C ++程序的帮助下向我解释会更好。

What is the difference between doubly linked list and multi linked list? It will be better explaining me with the help of a C/C++ program.

推荐答案

定义

一个多链表是一个链表,其中每个节点都可以包含指向链表中多个节点的指针。

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:


  1. 每个节点只有2个指针。

  1. 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;

这篇关于C / C ++中的双链表与多链表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆