Source: 📖 Problem Solving with Algorithms and Data Structures using Python 4.3
Date: 2021-10-28
An interesting and often useful characteristic of stacks is that they reverse the order of the items they contain as you remove them. The order of removal of the items in stack is the reverse of the order in which the items were added.
The back button in web browsers uses a stack data structure to keep track of visited pages. When you visit a new page, the previous page is added to the top of the stack. When the back button is clicked the item at the top of the stack is removed and loaded, allowing the user to traverse back through previously visited pages.