LOGBOOK

HELP

Quiz Entry - updated: 2026.09.29

What is the Stack ADT, and what are its operations?

A stack stores objects in last-in, first-out (LIFO) order: push(o) puts an element on top, pop() removes and returns the top element. Helper operations are top() (look without removing), size() and isEmpty().

Picture a stack of plates: you can only put a plate on top and only take the top one. The most recently added element is always the first to come out.

Operation What it does
push(o) insert o on top
pop() remove and return the top element
top() return the top element without removing it
size() number of stored elements
isEmpty() whether any elements are stored

Only the top is accessible. There is no operation to read the element at the bottom or in the middle, and that restriction is what makes a stack so cheap to implement: every operation touches one end.

Go deeper:

From Quiz: ADS / Linear Data Structures: Lists, Stacks, Queues, Deques, Iterators | Updated: Sep 29, 2026