About 210,000 results
Open links in new tab
  1. Stack in Python - GeeksforGeeks

    Jun 20, 2024 · This article covers the implementation of a stack using data structures and modules from the Python library. Stack in Python can be implemented using the following ways: list; Collections.deque; queue.LifoQueue; Implementation using list: Python’s built-in data structure list can be used as a stack.

  2. Top 50 Problems on Stack Data Structure asked in SDE Interviews

    Mar 29, 2025 · To learn about Stack Data Structure in detail, please refer to the Tutorial on Stack Data Structure. Easy Problems. Parenthesis Checker; Reverse a String using Stack; Postfix to Prefix ; Two stacks in an array; Delete Middle element from stack; Reverse individual words; Medium Problems. Queue using Stacks; Stack using Queues; Stack using single ...

  3. Python OOP: Stack class with push, pop, and display methods

    Apr 21, 2025 · Learn object-oriented programming (OOP) in Python by creating a stack class. Discover how to implement methods for pushing and popping elements, as well as displaying the stack's contents.

  4. Stack - Educative

    In this lesson, we are going to consider the stack data structure and its implementation in Python. In subsequent lessons, we’ll provide specific problems where a stack is particularly useful. We’ll be using the implementation that we develop in this lesson to solve those problems. What is a stack? First of all, let me describe what a stack is.

  5. Class 12 CS Python Stack Practice Questions - spsharmaclasses.com

    Write a program in Python, with separate user defined functions to perform the following operations on Stack 'City'. (a) - Push the pin code and name of the city in the stack 'City' (b) - Display the latest added element in the stack 'City' 4. In a stack, if a user tries to remove an element from empty stack, it is called --------

  6. data-structures-algorithms-python /data_structures /5_Stack

    Write a function in python that checks if paranthesis in the string are balanced or not. Possible parantheses are " {}'," ()" or " []". Use Stack class from the tutorial. This tutorial playlist covers data structures and algorithms in python.

  7. Python: Data Structures - Exercises, Practice, Solution

    Apr 1, 2025 · Write a Python program to create a LIFO queue. Go to the editor. Test your Python skills with w3resource's quiz.

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

    Apr 17, 2025 · Different ways to implement a stack in Python. In Python, a stack can be implemented in several different ways. The three main methods are using the built-in list data structure, using the collections.deque, or using linked lists. Let’s explore these methods. Using list to implement a stack. A list is the most common and easiest way to ...

  9. Exercise - Hands On Data Structures - Zhongpu

    As for stacks, another operation top() (also known as peek()) is often used. It works like pop(), but it will keep the item in the stack. Please implement peek() method in Java or Python. Please make it possible for Stack. Hint: you can refer to Python __len__() Magic Method. v = vals.pop() + v. elif op == '-': v = vals.pop() - v.

  10. Stacks - Sample implementation in Data Structures using Python

    Test your Data Structures using Python knowledge with our Stacks - Sample implementation practice problem. Dive into the world of college-data-structures-pyth challenges at CodeChef.

  11. Some results have been removed