Module pythonnds.stack
Stack is an abstract data type that serves as a collection of elements, with two main principal operations: Push, which adds an element to the collection, and Pop, which removes the most recently added element that was not yet removed.
Classes
-
class Stack -
Methods
-
def getSize(self) ‑> int -
Get size of the stack.
-
def isEmpty(self) ‑> bool -
Check if stack is empty.
-
def peek(self) ‑> ~T -
View top element in the stack.
-
def pop(self) ‑> ~T -
Remove element from the top of the stack.
-
def push(self, value: ~T) ‑> NoneType -
Add element to the top of the stack.
-