Open In App

Stack Data Structure

Last Updated : 30 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first, comes out last.

What is Stack Data Structure?

A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. It behaves like a stack of plates, where the last plate added is the first one to be removed.

Basic Operations of Stack Data Structures:

  • Push: Adds an element to the top of the stack.
  • Pop: Removes the top element from the stack.
  • Peek: Returns the top element without removing it.
  • IsEmpty: Checks if the stack is empty.
  • IsFull: Checks if the stack is full (in case of fixed-size arrays).

Applications of Stack Data Structures:

  • Recursion
  • Expression Evaluation and Parsing
  • Depth-First Search (DFS)
  • Undo/Redo Operations
  • Browser History

Basics of Stack Data Structure:

Implementations of Stack in Different Languages:

Other Implementations of Stack Data Structures:

Easy Problems on Stack Data Structures:

Medium Problems on Stack Data Structures:

Hard Problems on Stack Data Structures:

Quick Links :

Recommended:



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads