Computer Science
Answer
Stack | Queue |
---|---|
Stack follows LIFO (Last in First out) principle. | Queue follows FIFO (First in First out) principle. |
In stack, insertion and deletion occurs at one end only. | In queue, insertion occurs at the rear end and deletion occurs at the front end. |
In stack, Push operation is used for element insertion and Pop operation is used for element deletion. | In queue, enqueue is used for element insertion and dequeue is used for element deletion. |
There are no variations of stack. | A queue may be circular or deque. |
Related Questions
Fill in the blank
(a) …………… is a linear list of elements in which insertion and deletion takes place from different ends.
(b) Operations on a queue are performed in …………… order.
(c) Insertion operation in a queue is called …………… and deletion operation in a queue is called …………… .
(d) Deletion of elements is performed from …………… end of the queue.
(e) Elements 'A', 'S', 'D' and 'F' are present in the queue, and they are deleted one at a time, …………… is the sequence of element received.
(f) …………… is a data structure where elements can be added or removed at either end, but not in the middle.
(g) A deque contains 'z', 'x', 'c', 'v' and 'b' . Elements received after deletion are 'z', 'b', 'v', 'x' and 'c'. …………… is the sequence of deletion operation performed on deque.
How does FIFO describe queue ?
Write a menu driven python program using queue, to implement movement of shuttlecock in it's box.
How is queue data type different from deque data type?