Data Structures & Algorithms

Lists, stacks and queues

Use this for “After push 3, push 5, push 2, pop, what is on top?”

Explore

352top
Each push goes on top, so 2, pushed last, is on top and 3 is at the bottom.

Assumptions

•
A stack takes from the end it added to; a queue takes from the other end.
•
Each push, pop, enqueue or dequeue is constant time: no other item moves.
•
A circular queue of N slots reuses them: after slot N − 1 comes slot 0.
•
A linked list’s nodes each point to the next; the last points to nothing (∅).
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.

More problem types

© 2026 SME. All rights reserved.