Queue is a abstract data type which work on FIFO(First In First Out) manner.Queue perform insertion(this operation perform from rear end),d...
Queue is a abstract data type which work on FIFO(First In First Out) manner.Queue perform insertion(this operation perform from rear end),deletion operation(this operation perform from front end) in computer.Queue is used in c,c++,java,c# etc.
Type of Queue:-
1)Simple Queue(programming example is given below)
2)Circular Queue
3)D-Queue
4)Priority Queue
Let us take an non-programming example(Real World Example):-
Functions which are used in Queue:-
1)enqueue()
2)dequeue()
3)first()
4)IsEmpyt()
5)IsFull()
6)Length()
Example/implementation/algorithm of Simple Queue(Program):-
Program:-
That's all about Queue and its definition/meaning in data structure.
Type of Queue:-
1)Simple Queue(programming example is given below)
2)Circular Queue
3)D-Queue
4)Priority Queue
Let us take an non-programming example(Real World Example):-
Queue of people waiting at reception |
1)enqueue()
2)dequeue()
3)first()
4)IsEmpyt()
5)IsFull()
6)Length()
Example/implementation/algorithm of Simple Queue(Program):-
rear-->insert-->rear++
front-->delete-->front++Program:-
void add(int x)
{
if(rear==50)
cout<<"queue is full";
else
{
q[r]=x;
}
}
void delete()
{
if(f==r)
{
cout<<"queue is empty";
f=r=0;
}
else
cout<<"\n deletef element as<<q[f++]";
}
void display()
{
for(int i=f;i<f;i++)
cout<<"\n"<<q[i];
}
};
That's all about Queue and its definition/meaning in data structure.
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
COMMENTS