Skip to content

Latest commit

 

History

History

Stack

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Stack

A stack is an ordered list in which insertion and deletion are done at one end, called top. The last element inserted is the first one to be deleted. Hence, it is called the Last in First out (LIFO) or First in Last out (FILO) list.

When an element is inserted in a stack, the concept is called push, and when an element is removed from the stack, the concept is called pop. Trying to pop out an empty stack is called underflow and trying to push an element in a full stack is called overflow.

Main stack operations

  • Push (data): Inserts data onto stack.
  • Pop(): Removes and returns the last inserted element from the stack.

Auxiliary stack operations

  • Top(): Returns the last inserted element without removing it.
  • Size(): Returns the number of elements stored in the stack.
  • IsEmptyStack(): Indicates whether any elements are stored in the stack or not.
  • IsFullStack(): Indicates whether the stack is full or not.

Questions :

  • Balanced Bracket Problem ----> C++ | Java | Python
  • Evaluation of postfix expression ----> C++
  • Largest Rectangle ----> C++
  • Reverse individual words of a string ----> C++
  • Stack Class ----> C++
  • Stack using Linked List ----> Python
  • Stock Span Problem ----> C++ | Java | Python