Skills101
← Tech dictionary

Data structures & algorithms

What is Stack?

A stack is a last-in, first-out (LIFO) data structure: the last element pushed is the first one popped. Push, pop and peek take O(1) time.

Example

Undo in an editor, the browser back button and function call frames use stacks.

Learn it properlyDSA tutorials — free, with diagrams, quizzes and a certificate

Related terms