Stack Data Structure

  • Last Updated : 06 Feb, 2023

Learn more about Stack in DSA Self Paced Course
Practice Problems on Stack
Recent articles 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

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 :


  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
  6. Stack in Scala

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 :


GeeksforGeeks Courses:

Complete Interview Preparation

Get fulfilled all your interview preparation needs at a single place with the Complete Interview Preparation Course that provides you with all the required stuff to prepare for any product-based, service-based, or start-up company at the most affordable prices. Get access to over 200 coding questions, premium lectures, theoretical resources, practice tracks, and much more.

Live Courses

In GFG Live Classes, Get best-in-industry Interactive LIVE & Self-Paced Courses with Individual Attention by Leading Industry Experts to level up yourself and get into your dream company. Get real-time GFG Live Courses from the industry experts to encourage out-of-the-box thinking, leading to clarity in concepts, creativity and innovative ideas. Check out GeeksforGeeks valuable Live Courses –System Design Live, Competitive Programming Live, and more!

Language Foundation Courses[C Programming / C++ / JAVA / Python ]

Explore GeeksforGeeks Language Foundation Courses – C Programming | Java Foundation | Python Foundation | C++ Foundation – Learn any programming language from scratch and understand all of its core fundamentals for a strong programming foundation in the simplest way and best price possible with GeeksforGeeks Language Foundation Courses. These courses are for complete beginners who want to get started with programming and build their foundation.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up