SlideShare a Scribd company logo
1 of 4
Download to read offline
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3670
Comparison of Stack and Queue Data structures
Regi Maliyekkel S1, Anila M2
1HSST Computer Science, GHSS Vattenad, Palakkad, Kerala, India
2Asst Professor on Conract, University Centre, Manjery, Kerala, India
--------------------------------------------------------------------------***----------------------------------------------------------------------------
Abstract - This paper describes the comparative study of
the very familiar Data structures Stack and Queue. While
solving problems using computers, the data may have to be
processed. These data may be of atomic type or grouped
(aggregate). The grouped data are refereed using arrays and
structures. Stack and Queue are non-primitive datastructures
and are used for storing data elements and are actually based
on some real world equivalent. The main differences between
stack and queue are that stack uses LIFO (last in first out)
method to access and add data elements whereas Queue uses
FIFO (First in first out) method to accessand add. Basedon the
analysis, a comparative study is being made thus the user can
easily understand the working principle and operations of
these two data structures.
Key Words: Stack, Push, Pop, Queue, Deletion, Insertion,
Comparison
1. INTRODUCTION
The concept of data structure is similar to the collections
of plates in a stand, a set of disks in a CD pack and a queue in
which a new person can join the queue only at the rear end.
In computer science Data structure is a particular way of
organizing similar or dissimilar data items logically and can
be considered as a single unit. Since data structures
represents collections of data, these are closely related to
computer memory, as it is the storage space for data. Here
give a comparison study on two very familiar data structures
Stack and Queue.
1.1 Stack
The Stack is formed by placing each item one over the
other. We can say that the items are addedatthetopposition.
And also wecan remove thatitem whichisplacedatlast.This
is the Last-In-First-Out (LIFO) principle. The Stack follows
LIFO principle. In Stack all Insertions and deletions of data
items are done at one end called Top.
Implementation of stack using array
Stack can be implementedasarray,insuchacase,there
is a limit to the number of elements that can be represented
by the stack and it depends on the size of the array.
STACK
40 25 32 10
0 1 2 3 4 5
TOS
Figure -1
In the above figure- 1 TOS indicates Top Of Stack (Last
position of the element in the stack). So by STACK[TOS]
indicates the value of the last data item of the stack. Initially
the value of TOS set to -1.
1.1.1. Operations on Stack
Two Operations are possible on stack Push and Pop.
Push is for inserting data items into stack and Pop is for
removing data items from it.
Push Operation
Push Operation is the process of insertinganewdata
item into Stack. The following Algorithm shows the Push
Operation on a Stack. For this consider an array Stack[S] that
implements a stack, where S is the maximum size of the
array.
Figure - 2
Step 1: If TOS< S Then ( For checking Space availability)
Step 2: TOS=TOS+1
Step 3: Stack[TOS]= Val
Step 4: Else
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3671
Step 5: Print “Stack Overflow”
Step 6: End of If
Pop Operation
Pop operation is the process of deleting an
element from the top of Stack. After every deletion,theTOSis
decremented by One.ThefollowingAlgorithm showsthePop
Operation on a Stack. For this consider an array Stack[S] that
implements a stack, where S is the maximum size of the
array.
Figure -3
Step 1: If TOS> -1 Then ( For checking Empty Stack)
Step 2: Val=Stack[TOS]
Step 3: TOS=TOS-1
Step 4: Else
Step 5: Print “Stack Underflow”
Step 6: End of If
1.2 Queue
We might have became part of queue in our life like
billing payment in shops in which one person at the front
position billing the payment fist and a new person can join
the queue at the rear position. This style of Organizing a
group is called Fist-In-First-Out(FIFO) principle. A data
structure that follows FIFO is called Queue.
Implementation of Queue using array
Figure shows a queue using array of integerswhich
can accommodate maximum 6 elements. It contains 5
elements and Front value is 0 and Rear value is 4. The first
element is represented by QUEUE[FRONT] and the last
element is QUEUE[REAR].
1.2.1. Operations on Queue
Insertion and Deletion are the two operations
performed on Queue
Insertion Operation
Adding a data element into a queue at the rear end is
called Insertion. Following shows Algorithm for Insertion
Operations. For this Consider an array QUEUE[S] that
implements a queue of Size S. The variable Front and Rear
keep track of the position value of FrontandRearelementsof
the queue.
Figure -4
Step 1: If (REAR== -1) Then ( For checking Empty Queue)
Step 2: FRONT=REAR=0
Step 3: QUEUE[REAR]=Val
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3672
Step 4: Else If(REAR < S) Then
Step 5: REAR=REAR+1
Step 6: QUEUE[REAR]=Val
Step 7: Else
Step 8: Print “Queue Overflow”
Step 9: End of if
Deletion Operation
Removal of data items fromthefront endofqueueis
called Deletion operation. Following shows Algorithm for
Deletion Operation. For this Consider an array QUEUE[S]
that implements a queue of Size S. The variable Front and
Rear keep track of the position value of Front and Rear
elements of the queue.
Figure -5
Step 1: If (FRONT. -1 AND
FRONT < REAR) Then
(For checking Empty Queue)
Step 2 : Val=QUEUE[FRONT]
Step 3 : FRONT=FRONT+1
Step 4 : Else
Step 5 : Print “Queue Underflow”
Step 6 : End of If
Step 7: If (FRONT>REAR) Then (last element deletion
checking)
Step 8: FRONT=REAR= -1
Step 9 : End of if
2. Comparison between Stack and Queue
Stack Queue
Principle LIFO FIFO
Variables TOS
FRONT
REAR
Operations
PUSH
POP
Insertion
Deletion
Time
Complexity
O(1)(Inserting
Item)
O(1)(Removing
Item)
O(1)(Inserting
Item)
O(n)(Removing
Item in worst case)
Table -1
3. CONCLUSION
It can be concluded that we have seen the comparison
study of the two popular Data structure Stack and Queue.
And also explained the different operations performed on
these with proper Algorithms. Both are linear data
structures differ in certain ways like working mechanism,
structure, implementation, variants but both are used for
storing the elements in thelistandperformingoperationson
the list like addition and deletion of the elements. Parsing in
a compiler. Stack used in Java virtual machine, Undo in a
word processor, Back button in a Web browser etc and
Queue used in Data Buffers, Asynchronous data transfer
(fileIO, pipes, sockets), Traffic analysis etc.
REFERENCES
[1] https://techdifferences.com/difference-between-stack-
and-queue.html
[2] https://www.geeksforgeeks.org/difference- between-
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072
© 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3673
stack-and-queue-data-structures/
[3] https://ieeexplore.ieee.org/document/979991 Journals
& Magazines Volume: 28 Issue: 1
[4] IEEE Transactions on Software Engineering (Volume:
28 , Issue: 1 , Jan 2002 )
[5] Donald Knuth. The Art of Computer Programming
Volume1:FundamentalAlgorithms, Addison Wesley, 1997.
[6] RESEARCH PAPER ON STACK AND QUEUE Nitesh,
Manbir Singh, Rahul Yadav 2014 IJIRT Volume 1 Issue 7 |
ISSN: 2349

More Related Content

What's hot (20)

Dsa circular queue
Dsa circular queueDsa circular queue
Dsa circular queue
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Queue
QueueQueue
Queue
 
Queue
QueueQueue
Queue
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Circular Queue data structure
Circular Queue data structureCircular Queue data structure
Circular Queue data structure
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
basics of queues
basics of queuesbasics of queues
basics of queues
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Priority queues
Priority queuesPriority queues
Priority queues
 
Ds
DsDs
Ds
 
Queues
QueuesQueues
Queues
 
Foss4 g topology_july_16_2015
Foss4 g topology_july_16_2015Foss4 g topology_july_16_2015
Foss4 g topology_july_16_2015
 
Unit 5 dsa QUEUE
Unit 5 dsa QUEUEUnit 5 dsa QUEUE
Unit 5 dsa QUEUE
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)
 
Queue
QueueQueue
Queue
 
المحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابورالمحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابور
 
Link List
Link ListLink List
Link List
 

Similar to IRJET- Comparison of Stack and Queue Data Structures

Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queuePulkitmodi1998
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptxselemonGamo
 
computer notes - Memory organization
computer notes - Memory organizationcomputer notes - Memory organization
computer notes - Memory organizationecomputernotes
 
Data structure , stack , queue
Data structure , stack , queueData structure , stack , queue
Data structure , stack , queueRajkiran Nadar
 
Data Structure
Data Structure Data Structure
Data Structure Ibrahim MH
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptxskilljiolms
 
Stack Data Structure with Static Implementation (2).pptx
Stack Data Structure with Static Implementation (2).pptxStack Data Structure with Static Implementation (2).pptx
Stack Data Structure with Static Implementation (2).pptxEmroz Sardar
 
Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1blessyboban92
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdNimmi Weeraddana
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Getachew Ganfur
 

Similar to IRJET- Comparison of Stack and Queue Data Structures (20)

DSA Lab Manual C Scheme.pdf
DSA Lab Manual C Scheme.pdfDSA Lab Manual C Scheme.pdf
DSA Lab Manual C Scheme.pdf
 
Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queue
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptx
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
 
Data structures
Data structuresData structures
Data structures
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
computer notes - Memory organization
computer notes - Memory organizationcomputer notes - Memory organization
computer notes - Memory organization
 
Data structure , stack , queue
Data structure , stack , queueData structure , stack , queue
Data structure , stack , queue
 
Stack in C.pptx
Stack in C.pptxStack in C.pptx
Stack in C.pptx
 
Data Structure
Data Structure Data Structure
Data Structure
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
Stack Data Structure with Static Implementation (2).pptx
Stack Data Structure with Static Implementation (2).pptxStack Data Structure with Static Implementation (2).pptx
Stack Data Structure with Static Implementation (2).pptx
 
Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Data structure stack&queue basics
Data structure stack&queue   basicsData structure stack&queue   basics
Data structure stack&queue basics
 
Data structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pdData structures and algorithms short note (version 14).pd
Data structures and algorithms short note (version 14).pd
 
2 b queues
2 b queues2 b queues
2 b queues
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9
 
Rana Junaid Rasheed
Rana Junaid RasheedRana Junaid Rasheed
Rana Junaid Rasheed
 

More from IRJET Journal

TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...IRJET Journal
 
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURESTUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTUREIRJET Journal
 
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...IRJET Journal
 
Effect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil CharacteristicsEffect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil CharacteristicsIRJET Journal
 
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...IRJET Journal
 
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...IRJET Journal
 
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...IRJET Journal
 
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...IRJET Journal
 
A REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADASA REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADASIRJET Journal
 
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...IRJET Journal
 
P.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD ProP.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD ProIRJET Journal
 
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...IRJET Journal
 
Survey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare SystemSurvey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare SystemIRJET Journal
 
Review on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridgesReview on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridgesIRJET Journal
 
React based fullstack edtech web application
React based fullstack edtech web applicationReact based fullstack edtech web application
React based fullstack edtech web applicationIRJET Journal
 
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...IRJET Journal
 
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.IRJET Journal
 
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...IRJET Journal
 
Multistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic DesignMultistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic DesignIRJET Journal
 
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...IRJET Journal
 

More from IRJET Journal (20)

TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
 
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURESTUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
 
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
 
Effect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil CharacteristicsEffect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil Characteristics
 
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
 
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
 
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
 
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
 
A REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADASA REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADAS
 
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
 
P.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD ProP.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD Pro
 
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
 
Survey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare SystemSurvey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare System
 
Review on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridgesReview on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridges
 
React based fullstack edtech web application
React based fullstack edtech web applicationReact based fullstack edtech web application
React based fullstack edtech web application
 
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
 
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
 
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
 
Multistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic DesignMultistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic Design
 
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 

Recently uploaded (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 

IRJET- Comparison of Stack and Queue Data Structures

  • 1. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3670 Comparison of Stack and Queue Data structures Regi Maliyekkel S1, Anila M2 1HSST Computer Science, GHSS Vattenad, Palakkad, Kerala, India 2Asst Professor on Conract, University Centre, Manjery, Kerala, India --------------------------------------------------------------------------***---------------------------------------------------------------------------- Abstract - This paper describes the comparative study of the very familiar Data structures Stack and Queue. While solving problems using computers, the data may have to be processed. These data may be of atomic type or grouped (aggregate). The grouped data are refereed using arrays and structures. Stack and Queue are non-primitive datastructures and are used for storing data elements and are actually based on some real world equivalent. The main differences between stack and queue are that stack uses LIFO (last in first out) method to access and add data elements whereas Queue uses FIFO (First in first out) method to accessand add. Basedon the analysis, a comparative study is being made thus the user can easily understand the working principle and operations of these two data structures. Key Words: Stack, Push, Pop, Queue, Deletion, Insertion, Comparison 1. INTRODUCTION The concept of data structure is similar to the collections of plates in a stand, a set of disks in a CD pack and a queue in which a new person can join the queue only at the rear end. In computer science Data structure is a particular way of organizing similar or dissimilar data items logically and can be considered as a single unit. Since data structures represents collections of data, these are closely related to computer memory, as it is the storage space for data. Here give a comparison study on two very familiar data structures Stack and Queue. 1.1 Stack The Stack is formed by placing each item one over the other. We can say that the items are addedatthetopposition. And also wecan remove thatitem whichisplacedatlast.This is the Last-In-First-Out (LIFO) principle. The Stack follows LIFO principle. In Stack all Insertions and deletions of data items are done at one end called Top. Implementation of stack using array Stack can be implementedasarray,insuchacase,there is a limit to the number of elements that can be represented by the stack and it depends on the size of the array. STACK 40 25 32 10 0 1 2 3 4 5 TOS Figure -1 In the above figure- 1 TOS indicates Top Of Stack (Last position of the element in the stack). So by STACK[TOS] indicates the value of the last data item of the stack. Initially the value of TOS set to -1. 1.1.1. Operations on Stack Two Operations are possible on stack Push and Pop. Push is for inserting data items into stack and Pop is for removing data items from it. Push Operation Push Operation is the process of insertinganewdata item into Stack. The following Algorithm shows the Push Operation on a Stack. For this consider an array Stack[S] that implements a stack, where S is the maximum size of the array. Figure - 2 Step 1: If TOS< S Then ( For checking Space availability) Step 2: TOS=TOS+1 Step 3: Stack[TOS]= Val Step 4: Else
  • 2. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3671 Step 5: Print “Stack Overflow” Step 6: End of If Pop Operation Pop operation is the process of deleting an element from the top of Stack. After every deletion,theTOSis decremented by One.ThefollowingAlgorithm showsthePop Operation on a Stack. For this consider an array Stack[S] that implements a stack, where S is the maximum size of the array. Figure -3 Step 1: If TOS> -1 Then ( For checking Empty Stack) Step 2: Val=Stack[TOS] Step 3: TOS=TOS-1 Step 4: Else Step 5: Print “Stack Underflow” Step 6: End of If 1.2 Queue We might have became part of queue in our life like billing payment in shops in which one person at the front position billing the payment fist and a new person can join the queue at the rear position. This style of Organizing a group is called Fist-In-First-Out(FIFO) principle. A data structure that follows FIFO is called Queue. Implementation of Queue using array Figure shows a queue using array of integerswhich can accommodate maximum 6 elements. It contains 5 elements and Front value is 0 and Rear value is 4. The first element is represented by QUEUE[FRONT] and the last element is QUEUE[REAR]. 1.2.1. Operations on Queue Insertion and Deletion are the two operations performed on Queue Insertion Operation Adding a data element into a queue at the rear end is called Insertion. Following shows Algorithm for Insertion Operations. For this Consider an array QUEUE[S] that implements a queue of Size S. The variable Front and Rear keep track of the position value of FrontandRearelementsof the queue. Figure -4 Step 1: If (REAR== -1) Then ( For checking Empty Queue) Step 2: FRONT=REAR=0 Step 3: QUEUE[REAR]=Val
  • 3. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3672 Step 4: Else If(REAR < S) Then Step 5: REAR=REAR+1 Step 6: QUEUE[REAR]=Val Step 7: Else Step 8: Print “Queue Overflow” Step 9: End of if Deletion Operation Removal of data items fromthefront endofqueueis called Deletion operation. Following shows Algorithm for Deletion Operation. For this Consider an array QUEUE[S] that implements a queue of Size S. The variable Front and Rear keep track of the position value of Front and Rear elements of the queue. Figure -5 Step 1: If (FRONT. -1 AND FRONT < REAR) Then (For checking Empty Queue) Step 2 : Val=QUEUE[FRONT] Step 3 : FRONT=FRONT+1 Step 4 : Else Step 5 : Print “Queue Underflow” Step 6 : End of If Step 7: If (FRONT>REAR) Then (last element deletion checking) Step 8: FRONT=REAR= -1 Step 9 : End of if 2. Comparison between Stack and Queue Stack Queue Principle LIFO FIFO Variables TOS FRONT REAR Operations PUSH POP Insertion Deletion Time Complexity O(1)(Inserting Item) O(1)(Removing Item) O(1)(Inserting Item) O(n)(Removing Item in worst case) Table -1 3. CONCLUSION It can be concluded that we have seen the comparison study of the two popular Data structure Stack and Queue. And also explained the different operations performed on these with proper Algorithms. Both are linear data structures differ in certain ways like working mechanism, structure, implementation, variants but both are used for storing the elements in thelistandperformingoperationson the list like addition and deletion of the elements. Parsing in a compiler. Stack used in Java virtual machine, Undo in a word processor, Back button in a Web browser etc and Queue used in Data Buffers, Asynchronous data transfer (fileIO, pipes, sockets), Traffic analysis etc. REFERENCES [1] https://techdifferences.com/difference-between-stack- and-queue.html [2] https://www.geeksforgeeks.org/difference- between-
  • 4. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 06 Issue: 06 | June 2019 www.irjet.net p-ISSN: 2395-0072 © 2019, IRJET | Impact Factor value: 7.211 | ISO 9001:2008 Certified Journal | Page 3673 stack-and-queue-data-structures/ [3] https://ieeexplore.ieee.org/document/979991 Journals & Magazines Volume: 28 Issue: 1 [4] IEEE Transactions on Software Engineering (Volume: 28 , Issue: 1 , Jan 2002 ) [5] Donald Knuth. The Art of Computer Programming Volume1:FundamentalAlgorithms, Addison Wesley, 1997. [6] RESEARCH PAPER ON STACK AND QUEUE Nitesh, Manbir Singh, Rahul Yadav 2014 IJIRT Volume 1 Issue 7 | ISSN: 2349