Computer Science

Compare and contrast queue with stack.

Python Queue

2 Likes

Answer

StackQueue
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.

Answered By

3 Likes


Related Questions