8/23/2019 Difference Between Stack And Queue
In this article you will learn about difference between stack and queue.
Jan 27, 2016 - Queue is a FIFO (first in first out) data structure. The main difference between the two is how new elements enter the list and old elements.
Stack
A Stack data structure works on Last In First Out principle, also abbreviated as LIFO. A Stack requires only one reference variable, known as a top pointer. Stack data structures are normally represented as a vertical representation of data items.
A Stack Data Structure can be represented in static arrays as well as linked lists. In a stack, the data items can be inserted and deleted from the same end. The element to be inserted first is the last element to get deleted. Both the operations, insertion and deletion occur at the TOP reference pointer. A Stack doesnât necessarily contain ordered collection of data items.
Stack Implementations:
Stack data structure is used in infix to postfix conversion, scheduling algorithms, evaluation of an expression and depth first search.
The condition to check if a stack is empty:
Comment below if you found anything incorrect or have doubts related to above difference between stack and queue tutorial.
You May Also Like:
What is the difference between Stack and Queue data structure?
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |