Greg Hogg introduces the stack: append and pop at the end of a dynamic array, which is what a Python list is, each O(1) on average.