0% found this document useful (0 votes)
33 views12 pages

DS Seminar

Uploaded by

Janani.k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views12 pages

DS Seminar

Uploaded by

Janani.k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

QUEUE

By K.JANANI - BSC CS WITH CS


QUEU A Queue is defined as a linear data
E: structure that is open at both ends and
the operations are performed in First
In First Out (FIFO) order.
• The removal of existing items

FIFO happen at front of the Queue.


• The addition of new items
PRINCIPLE: happens at rear of the Queue.
CHARACTERISTIC REPRESENTATION
S: :

• ·Queue can handle multiple • Queue: the name of the array


data. storing queue elements.
• ·We can access both ends. • Front: the index where the

• They are fast and flexible. first element is stored


• Rear: the index where the last
element is stored
BASIC OPERATIONS:
• enqueue() – Insertion of elements.
• dequeue() – Removal of elements.
• peek() or front()- Acquires the data
element available at the front node.
• rear() – returns the element at the
rear end.
• isFull() – Validates if the queue is
full.
• isEmpty() – Checks if the queue is
empty.
• size() - returns the size of the queue.
ENQUEUE( DEQUEUE(
): ):
front(): rear():
int front(Queue* queue) int rear(Queue* queue)
{ {

if (isempty(queue)) if(isEmpty(queue))

return return INT_MIN;


INT_MIN;
return queue->arr[queue->front]; return queue->arr[queue->rear];
}
}
ISEMPTY() SIZE()
: :
#include<iostream>
#include<queue>
b using namespace std;
o int main()
ol {
int sum = 0;
queue<int>
is myqueue;
E myqueue.push(1);
myqueue.push(8);
m
myqueue.push(3);
pt myqueue.push(6);
y( myqueue.push(2);
) cout << myqueue.size();
return 0;
}
{
TYPES OF QUEUE:
ADVANTAGE
S:
• Easy to implement.
• Managed efficiently .
• Performs various operations.

DISADVANTAGE
S:
• Fixed size.
• Incase of large queue ,failure.
• Maximum queue - priority defined.
ANY
QUESTIONS?
THANK YOU!

You might also like