Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
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?
Posted
Comments
Sergey Alexandrovich Kryukov 3-Nov-11 1:32am    
What, Google banned you, again? :-)
--SA

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

Also, Doubly-Linked and Circular Lists
[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Nov-11 1:33am    
Should help, good descriptive links, my 5.
--SA
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.

C++
struct node
{
  int   data;

  node* pNext;
  node* pPrev;
};


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.
 
Share this answer
 
Implementation of Doubly Circular linked list here :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900