Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Queue

Rating
-
Sold
-
Pages
6
Uploaded on
23-12-2024
Written in
2024/2025

In data structures, a queue is a linear data structure that follows the FIFO (First-In-First-Out) principle. This means that the first element added to the queue will be the

Institution
Course

Content preview

cover all the basics of Queue, Operations on Queue, its implementation,
advantages,
disadvantages which will help you solve all the problems based on Queue.



Introduction to Front /Heod Bock/ Tail /Rear
Dequeue

Queue 4 5
Enqueue




What is Queue Data Structure?
Queue Data Structure is a linear data structure that is open at both ends and the operations
are performed in First In First Out (FIFO) order.
We definea queue to be a list in which all additions to the list are made at one end (back of
the queue), and all deletions from the list are made at the other end(front of the queue). The
element which is first pushed into the order. the delete operation is first performed on that.
FIFO Principle of Queue Data Structure:
A Oueue is like a line waiting to purchase tickets, where the first person in line is the
first person served. (i.e. First Come First Serve).
Position of the entry in a queue ready to be served, that is, the first entry that will be
removed from the queue, is called the front of the queue(sometimes, head of the
queue). Similarly, the position of the last entry in the queue, that is, the one most
recently added, is called the rear (or the tail) of the queue.
FIFO Principle (First in First Out)
FIRST TO LAST TO
GET TICKET GET TICKET
AND LEAVE AND LEAVE




TICKET OLDEST SECOND THIRD NEWEST
CHECKER PERSON PERSON PERSON PERSON
(FIRST) (UAST)


Basic Operations in Queue Data Structure:
Some of the basic operations for Queue in Data Structure are:
1. Enqueue: Adds (or stores) an element to the end of the queue.

, 2. Dequeue: Removal of elements from the queue.
3. Peek or front: Acquires the data element available at the front node of the queue
without deleting it.
4. rear: This operation returns the element at the rear end without removing it.
5. isFull: Validates if the queue is full.
6. isEmpty: Checks if the queue is empty.
There are a few supporting operations (auxiliary operations):
1. Enqueue Operation in QQueue Data Structure:
Enqueue() operation in Queue adds (or stores) an element to the end of the queue.
The following steps should be taken to enqueue (insert) data into a queue:
Step 1: Check if the queue is full.
Step 2: If the queue is full, return overflow error and exit.
Step 3: If the queue is not full, increment the rear pointer to point to the next empty
space.
Step 4: Add the data element to the queue location, where the rear is pointing.
Step 5: return success.
2. Dequeue Operation in Queue Data Structure:
Removes (or access) the first element from the queue.
The following steps are taken to perform the dequeue operation:
Step 1: Check if the queue is empty.
Step 2: If the queue is empty, return the underflow error and exit.
Step 3: If the queue is not empty, access the data where the front is pointing.
element.
Step 4: Increment the front pointer to point to the next available data
Step 5: The Return success.

3. Front Operation in Queue Data Structure:
it.
This operation returns the element at the front end without removing
The following steps are taken to perform the front operation:
If the queue is empty return the most minimum value.
otherwise, return the front value.


4. Rear Operation in Queue Data Structure:
removing it.
This operation returns the element at the rear end without
The following steps are taken to perform the rear operation:
value.
If the queue is empty return the most minimum
otherwise, return the rear value.


5. isEmpty Operation in Queue Data Structure:
whether the queue is empty or not.
This operation returns a boolean value that indicates
The following steps are taken to perform the Empty operation:
means queue is
check if front value is equal to -1 or not, if yes then return true
empty.
Otherwise return false, means queue is not empty

Written for

Institution
Course

Document information

Uploaded on
December 23, 2024
Number of pages
6
Written in
2024/2025
Type
SUMMARY

Subjects

$11.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
devapathma0607

Get to know the seller

Seller avatar
devapathma0607 Nil
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
4
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions