Implementation of Queue using Link List Briefly program in C++ ...

Implementation of Queue using Link List

Today we will discussed about the “Implementation of Queue using Link list”. Do you remember that we learn about the Link list in our last tutorial as well as Queue using Array. If you remember that Queue is just like a straight Pipe that have two ends. The insertion end of this pipe From Rare and deletion end from Front side.
In “Implementation of Queue using Link list” we always use the circular Queue not use the simple Queue.
Circular Queue means that If the our Rare side is full of data and we delete some data from Front side the or Program is automatically  adjust the Rare side from last to one. Circular Queue is just like as….
Implementation of Queue using Link List Briefly program in C++
Implementation of Queue using Link List [howpk.com]
The other application of the Stack is same just like that   Queue is the FIFO(First In First Out),Non primitive Data Structure ,ADT(Abstract Data Type), Push And Pop Function  etc… The Queue using Link list just like as….
Implementation of Queue using Link List Briefly program in C++
Queue[howpk.com]

The Program of Queue using Link List

#include<iostream>
using namespace std;
struct node
{
int data;
struct node *link;
};
class Queue
{
private:
struct node *f,*R,*t;
public:
Queue()
{
f=NULL;
R=NULL;
}
int tra()
{
t=f;
while(t!=NULL)
{
cout<<t->data<<endl;
t=t->link;
}
}
int insert()
{
t=new node;
cout<<”\tEnter the values\t”;
cin>>t->data;
if(f==NULL)
{
t->link=NULL;
f=t;
R=t;
}
else
{
t->link=NULL;
R->link=t;
R=t;
}
}
int delect()
{ if (f==NULL)
cout<<”\tQueue is empty\t”<<endl<<endl;
else
f=f->link;
}
};
int main()
{ char y;
Queue a;
do
{
cout<<”\tWant to inert the data and delect the data in Queue ['i','d']\t”;
cin>>y;
if(y==’i’)
{
a.insert();
a.tra();
}
else if(y==’d’)
{
a.delect();
a.tra();
}
else
cout<<”\t \tInvailed Selection”<<endl;
cout<<”Want to prform more operations [y/N]“<<endl;
cin>>y;
}while(y==’y’);
}

you may also like to readBY HaRis
Implementation of Queue using Link List Briefly program in C++ ... Implementation of Queue using Link List Briefly program in C++ ... Reviewed by Don't Play on 15:38:00 Rating: 5

No comments:

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();
Powered by Blogger.