Summary
In this chapter, you learned about the stack data structure. We implemented our own algorithm that represents a stack and you learned how to add and remove elements from it using the push
and pop
methods. We also covered a very famous example of how to use a stack.
In the next chapter, you will learn about queues, which are very similar to stacks but use a different principle than LIFO.