A collection of data structures and algorithms I’m writing while learning
This is a collection of data structures and algorithms that I write while learning the subject
Stack:
stack.py A stack algorithm is a data structure that is like a pack of cards – a stack. Stack has the following properties:
Push
Adds element to the top of the stack
Pop
Removes element from the top of the stack
Peek
Returns the element at the top of the stack
Size and is_empty are just helper functions
Stuff Done with stack:
-
Checking if a bracket string is balanced Explanation:
- Add all brackets in the stack one
- Add all brackets in the stack one