Back

Stack Visualization Using JavaScript

What is a Stack.

A stack is an abstract data type that serves as a collection of elements, with two principal operations. Push, which adds an element to the collection. Pop, removes the most recently added element. The order in which elements come off a stack gives rise to its alternative name, LIFO (for last in, first out).

Stacks are super useful for multiple operations such as browsers (the back button) The below UI example would help in visualizing the Stack operations i.e Push, Pop, top and Find Min and Max. I edited the original code, to change it from an Array Based implementation of stacks, to LinkedList based one.

Push
Pop
Top
Status
Runtime Complexity
Access Search Insertion Deletion Space Complexity(Worst)
Θ(n) Θ(n) Θ(1) Θ(1) Θ(n)