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
Class notes

Class notes BCA 402

Rating
-
Sold
-
Pages
11
Uploaded on
01-03-2025
Written in
2024/2025

This notes are written in very simple and easy language, understand to anyone.

Institution
Course

Content preview

DATA STRUCTURE
INTRODUCTION TO QUEUE [12 Marks]


INTRODUCTION TO QUEUE
 Introduction
o Queues as an abstract data type
o Representation of a Queue as an array
 Types of Queue
o Circular Queue
o Double Ended Queue
o Priority Queue
o Dequeues
 Applications of Queue


Introduction To Queue
Queue is a linear data structure used to represent a linear list. Queue is a linear list of elements in which
deletion of an element can take place only at one end, called as the FRONT and insertion can take place
only at the other end, called the REAR.
The first element in a queue will be the first one to be removed from the list. Therefore, queues are also called
FIFO (First In First Out) lists.
Defination
Queue is a linear data structure which follow First in First out (FIFO) princliple, where elements are added at
REAR end and deleted from FRONT end.
ABSTRACT DATA TYPE .
The definition of an abstract data type in data structure must have following properties
 There should be a particular way in which elements are related to each other.
 A statement of the operations that can be performed on elements of the ADT should be specified.
QUEUE AS AN ABSTRACT DATA TYPE .
A queue of elements of type A is a finite sequence of elements. Thus, a queue, as an ADT, can be defined
with following properties:
 Initialize a queue to be empty.
 Determine if a queue is empty or not.
 Determine if a queue is full or not.
 Insert a new element after the last element in a queue, if it is not full. [Overflow]
 Retrieve the element of FRONT position, from a queue, if it is not empty. [Underflow]
 Delete the FRONT element from the queue, if it is not empty.
Programming Point of view stack as ADT has define as follow.
 Array implementation of QUEUE, which contains integer type of elements
Int QUEUE[10]; // Here QUEUE is an array of Integer type with SIZE 10.
Int FRONT=-1; // FRONT is variable (initially NULL) used to show the position of element to delete.
Int REA R=-1; // REAR is variable (initially NULL) used to show the position of element to insert.
Subject: Data Structure (Queue) Print Date:14/Oct/2019 Page 1 of 11

, Int MAX=10; //MAX is a variable shows the maximum size of queue.
Operations…..
void init(); // This procedure initialise the QUEUE to empty state
(FRONT=-1, REAR=-1,MAX=10).
void insert(int item); // This procedure add new element into the QUEUE at REAR position.
void remove( ); // This procedure remove FRONT element from the QUEUE.
int peek( ); // This procedure returns TOP element from the STACK for processing.
int isEmpty(); // This function return 1(TRUE) if QUEUE is empty, otherwise 0.
int isFull(); // This function return 1(TRUE) if QUEUE is full, otherwise 0.
void show(); // This function show elements of QUEUE as they are inserted.


 Stack may formally also define as follow
struct QUEUE
Here struct QUEUE is define with 3 members
{  DATA (Integer Array), FRONT (To show the position of
Int DATA[10]; delete) , REAR (To show the position of insert) and MAX
(Size of Queue).
Int FRONT;  The name of object is queue (small letters)
Int REAR;  We can access members through pointer object through
functions (Call By Referance)
Int MAX;
}queue;
Operations…..
void init(struct QUEUE &pointerQueue);
// This procedure initialise the QUEUE to empty state as follow
void insert(struct QUEUE &pointerQueue ,int item);
// This procedure add new element into the FRONT of the QUEUE.
void remove(struct QUEUE &pointerQueue);
// This procedure remove the TOP element from the STACK.
int isEmpty(struct QUEUE &pointerQueue);
// This function return 1(TRUE) if QUEUE is empty, otherwise 0.
int isFull(struct QUEUE &pointerQueue);
// This function return 1(TRUE) if QUEUE is full, otherwise 0.
void show(struct QUEUE &pointerQueue);
// This function show elements of QUEUE as they are inserted.


PREMITIVE OPERATIONS ON STACK.


 Creation : To Initialise queue as an empty queue.
 Insert : Adds a given element to the REAR end of the queue leaving previous items below.
 Remove : Removes and returns the current node of the queue (of FRONT position).
 Traversing : To Visit each element of the queue.
 Display : To Read each element of the queue and display it.


Subject: Data Structure (Queue) Print Date:14/Oct/2019 Page 2 of 11

Written for

Institution
Course

Document information

Uploaded on
March 1, 2025
Number of pages
11
Written in
2024/2025
Type
Class notes
Professor(s)
Prof. nitin shah
Contains
All classes

Subjects

$6.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
kajalsonawane

Also available in package deal

Get to know the seller

Seller avatar
kajalsonawane DDSGP College Chopda
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
5
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