Stack: Difference between revisions

From Wiki :-)
Jump to navigation Jump to search
Created page with "Stack is a data structure upon which two operations are applicable: push and pop."
 
No edit summary
Line 1: Line 1:
Stack is a data structure upon which two operations are applicable: push and pop.
Stack is a data structure that uses a LIFO (last-in first-out) upon which the following operations are supported:
* push(object): add object on the top of the stack O(1)
* pop(): remove the object which on the top of the stack O(1)
* peek(): return object which is on the top of the stack O(1)
A stack can be used to implement recursive algorithm iteratively.

Revision as of 17:29, 2 October 2020

Stack is a data structure that uses a LIFO (last-in first-out) upon which the following operations are supported:

  • push(object): add object on the top of the stack O(1)
  • pop(): remove the object which on the top of the stack O(1)
  • peek(): return object which is on the top of the stack O(1)

A stack can be used to implement recursive algorithm iteratively.