Saturday, 19 January 2013

Circular Linked List


By on 02:35

Circular linked list  are those linked list which are reaching the first node after reaching the end node.In circular linked list the last  node not contains the NULL pointer but contain the address of first node.It is used in c ++,java,c# etc.



Example/implementation or Algorithm/program of Circular linked  list:-



#include<iostream.h>

#include<conio.h>
#include null 0
#include<stdio.h>
#include<stdlib.h>

void main()

{
struct link
{
int info;
struct link* next;
}*start,*node;
char ch;
clrscr();
start=null;
node=null;
do
{
if(node==null)
{
node=new link;
start=node;
}
else
{
node->next=node link;
node=node->next;
}
cout<<"enter information for node";
cin>>node->info;
Cout<<"want to continue";
flushall();
cin>>ch;
}while(ch!='n');
node->next=null;
node=start;
cout<<"List=";
do
{
cout<<node->info;
node=node->next;
}while(node!=start);
getch();
}



That's all about Circular Linked List in data structure.


If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...