Difference Between Stack And Queue in Tabular Form
SNo. | Basic Terms | Stack | Queue |
1. | Definition | Stack is a linear data structure which follows a particular order in which the operations are performed.a Stack is open at one ends. | Queue is an abstract data structure, somewhat similar to Stacks.Unlike stacks, a queue is open at both its ends. |
2. | Sequence of Elements Processing | LIFO Last In First Out | FIFO First Come First Out |
3. | Number of pointers used | 1 Pointers | 2 Pointers |
4. | Operations performed | Push and Pop | Enqueue and dequeue |
5. | Representation | Vertical | Horizontal |
6. | Reference for data processing | Stack contains TOP | Queue contains REAR and FRONT |
7. | Position of data items | data items are inserted and deleted from the same end. | data items in a queue are inserted and deleted from different ends. |
8. | Element inserted | First inserted | Insertion at REAR end |
9. | Element deleted | Last inserted | Deletion at FRONT end. |
10. | Application | Used in infix to postfix conversion, scheduling algorithms, depth first search and evaluation of an expression. | A Queue offers services in operations research, transportation and computer science that involves persons,data, events and objects to be stored for later processing. |
11. | Real Example |
|
|
12. | Different Type | No |
|
13. | check if full | TOP == MAX – 1 | REAR == MAX – 1 |
14. | check If empty | TOP == -1 | FRONT == REAR |
15. | Diagram |
(Visited 1,805 times, 1 visits today)
Written by: