We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Stack Review

  • All supported operations are O(1) by themselves. However, some tasks, like getting to an item at the bottom of the stack have a higher time complexity because they require multiple pop operations.
  • Stack operations are limited: no searching, no sorting, no random access
  • Stacks, like all abstract data types, can store items of any type. What makes it a stack is the behavior of the operations, not the type of data it stores.
  • Stacks are often used in the real world for:
    • Function call management
    • Undo/redo functionality
    • Expression evaluation
    • Browser history