Skip to content

Latest commit

 

History

History

04-chapter-Stack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Stacks with ES6

Code Examples

Description

Pattern type: Last item In is the First item Out (LIFO)

common operations you can perform on graphs:

  • push: adds a new element to the stack
  • pop: remove the last item pushed from the stack
  • peek: returns the last item pushed to stack
  • length: returns the size of the stack
  • isEmpty: returns true if the stack has elements or false if it has no elements
  • getStack: returns the data of the stack

Example use case

  • Using the back and forward buttons in your browser
  • dfs search algorithm for graphs search
  • balanced arithmetic operations
  • convert infix to postfix arithmetic operations
  • JS engine uses a stack data structure to execute the algorithms

Resources