(双循环链表)它是如何工作的? [英] (Doubly circular linked list) how it works?

查看:103
本文介绍了(双循环链表)它是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解双循环链表



特别想知道头节点机制。第一个节点和最后一个节点机制。



数据结构如何存储在信息部分?



双循环链表需要多少指针并初始化还是?

i want to know about doubly circular linked list

specialy want to know about head node mechanism.first node and last node mechanism.

how a structure of data is stored in info part?

how many pointers are required for doubly circular linked list and there initialization also?

推荐答案

看看下面这篇文章:

Circular_doubly_linked_lists [ ^ ]。



另外,双重链接和循环列表

[ ^ ]
Take a look at the following article:
Circular_doubly_linked_lists[^].

Also, Doubly-Linked and Circular Lists
[^]


您需要有一个节点o bject,指向列表中的下一个节点和上一个节点,以及要存储在节点中的其他数据。



You need to have a node object, that has a pointer to the next node and the previous node in your list, as well as the other data you want to store in the node.

struct node
{
  int   data;

  node* pNext;
  node* pPrev;
};





您的列表对象将有一个头节点,它是列表的起始节点。

当只有1个节点时,prev和next指针将指向自身。

2个节点,next和prev指针指向另一个节点,并跟踪哪一个是头节点。

3及以上,你有一个连接链节点,最终绕回头部,导航可以向任何方向移动。



your list object will have a head node, which is the starting node of the list.
When there is only 1 node, then the prev and next pointers will point to itself.
2 nodes, both next and prev pointers point to the other node, and keep track of which one is the head node.
3 and up, you have a connected chain of nodes, that eventually circle around back to the head, and navigation can move either way.


双循环链表这里:))


这篇关于(双循环链表)它是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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