Stack Data Structure

  • Last Updated : 27 Sep, 2023

DSA for Beginners
Learn more about Stack in DSA Self Paced Course
Practice Problems on Stack
Top Quizzes on Stack

What is Stack?

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.

Stack Data Structure

There are many real-life examples of a stack. Consider an example of plates stacked over one another in the canteen. The plate which is at the top is the first one to be removed, i.e. the plate which has been placed at the bottommost position remains in the stack for the longest period of time. So, it can be simply seen to follow LIFO(Last In First Out)/FILO(First In Last Out) order.

Topics :

Introduction:

  1. Introduction to Stack – Data Structure and Algorithm Tutorials
  2. Applications, Advantages and Disadvantages of Stack
  3. Implement a stack using singly linked list
  4. Introduction to Monotonic Stack

Implementation of Stack in different languages:

  1. Stack in C++ STL
  2. Stack Class in Java
  3. Stack in Python
  4. Stack in C#
  5. Implementation of Stack in JavaScript

Some other Implementation of Stack:

  1. Implement Queue using Stacks
  2. Design and Implement Special Stack Data Structure | Added Space Optimized Version
  3. Implement two stacks in an array
  4. Implement Stack using Queues
  5. How to efficiently implement k stacks in a single array?
  6. Design a stack that supports getMin() in O(1) time and O(1) extra space
  7. Implement a stack using single queue
  8. How to implement stack using priority queue or heap?
  9. Create a customized data structure which evaluates functions in O(1)
  10. Implement Stack and Queue using Deque

Standard problems on Stack:

Quick Links :

Recomended: