About 512,000 results
Open links in new tab
  1. C# Stack with Examples - GeeksforGeeks

    Jan 31, 2025 · In C# a Stack is a Collection that follows the Last-In-First-Out (LIFO) principle. It is used when we need last-in, first-out access to items. In C# there are both generic and non-generic types of Stacks. The generic stack is in the System.Collections.Generic namespace, while the non-generic stack is in System.Collections.

  2. Stack Class in Java - GeeksforGeeks

    Apr 15, 2025 · Example: Here, we are implementing the Stack class. Explanation: In the above example, we are creating an empty stack of integer and then we are pushing four elements onto the stack with the help of push () method.

  3. Stack Data Structure and Implementation in Python, Java and …

    A stack is a useful data structure in programming. It is just like a pile of plates kept on top of each other. In this tutorial, you will understand the working of Stack and it's implementations in Python, Java, C, and C++.

  4. What is Stack Data Structure? A Complete Tutorial

    Mar 6, 2025 · A stack is a linear data structure that stores items in a Last-In/First-Out (LIFO) or First-In/Last-Out (FILO) manner. In stack, a new element is added at one end and an element is removed from that end only. The insert and delete operations are often called push and pop. The functions associated wi

  5. C++ Stack - Exercises, Practice, Solution - w3resource

    Apr 14, 2025 · In computer science, a stack is an abstract data type that serves as a collection of elements, with two main operations: Pop, which removes the most recently added element that was not yet removed.

  6. A Complete Guide to Stacks in Python

    Apr 9, 2025 · A tutorial on stacks in Python. | Video: codebasics. More on Python Python Regular Expression re.match() and re.sub() Explained. Disadvantages of Stack in Python. Limited flexibility: Since stacks operate in LIFO order, accessing elements other than the top element is inefficient.; Memory usage: If not managed properly, stacks can cause excessive memory consumption, leading to stack overflow ...

  7. Python Stack Data Structure: When and Why to Use it

    3 days ago · Let’s also look at an example from everyday computing – the undo button. When you use a text editor or drawing app, every action you take is recorded in order. Pressing undo removes the most recent action first, just like taking the top item off a stack. The Python stack follows a specific rule called Last-In, First-Out (LIFO). Let’s ...

  8. C++ Stack - Programiz

    In C++, the stack class provides various methods to perform different operations on a stack. We use the push() method to add an element into a stack. For example, int main() { stack<string> colors; colors.push("Red"); colors.push("Orange"); while(!colors.empty()) { cout << colors.top() << ", "; colors.pop(); return 0; Output.

  9. Top 12 Stack Examples in Real Life: Practical Applications - upGrad

    Mar 5, 2025 · In data structures, a stack is represented as a collection where elements are added and removed from the top. The 'top' pointer indicates the current end of the stack. Key operations include: Push: Adds an element to the top. Pop: Removes the top element. Peek: Retrieves the top element without removing it.

  10. Java Stack Example (with video) - Java Code Geeks

    Aug 8, 2019 · In this post, we feature a comprehensive Java Stack Data Structure Example. 1. Introduction. A stack data structure is a container of objects that are inserted and removed according to the last-in-first-out (LIFO) principle. In the stacks, only two operations are allowed- pop the item out of the stack. A stack is a limited access data structure.

  11. Some results have been removed
Refresh