Uses of Stacks
Stacks are used in many places in computer science:
- Most programming languages keep variable values on a runtime stack.
- The SPARC architecture has a register file stack in the CPU.
- Operating systems keep the state of interrupted processes on a stack.
- A web browser keeps a stack of previously visited web pages;
this stack is popped when the Back button is clicked.
- Compilers use a stack when parsing programming languages.
- In general, a stack is needed to traverse a tree.