Stack data structure :
Stack is a linear data structure which follows a particular order in which the operations are performed.
Best answer
Stack data structure :
Stack is a linear data structure which follows a particular order in which the operations are performed.
Answer: A stack is a linear data structure that works on LIFO (Last In, First Out); a queue is a linear data structure that works on FIFO (First In, First Out).
Stack
push (insert at top), pop (remove from top), peek (see top element). Errors: overflow (push on a full stack) and underflow (pop on an empty stack).Queue
enqueue (insert at rear), dequeue (remove from front).| Point | Stack | Queue |
|---|---|---|
| Order | LIFO | FIFO |
| Ends used | One (top) | Two (front, rear) |
| Insert / delete | push / pop | enqueue / dequeue |
Log in or create a free account to answer this question.