FANDOM


A Stack is an Abstract Data Type (ADT) to store and retrieve values in a "Last-In, First-Out"(LIFO) fashion.

Stacks are used when we need to access data in reverse order of their arrival. They are commonly used in recursive function calls, expression parsing, depth first search in graphs etc.

Stack Operations Edit

The following operations can be performed on a stack:

  • push() - add an item to the top of the stack
  • pop() - remove an item from the top of the stack
  • peek() - look up the value of topmost item of the stack without removing it
  • isEmpty() - checks if the stack is empty
  • isFull() - checks if the stack is full

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.