Stacks
A stack adds and removes at one end only, last in first out, both $O(1)$ at the end of a Python list, which is exactly the order needed to match brackets, undo edits and run function calls.
A stack adds and removes at one end only, last in first out, both $O(1)$ at the end of a Python list, which is exactly the order needed to match brackets, undo edits and run function calls.