Stacks have a variety of applications in real-world problems. They can be used for backtracking problems to remember tasks or paths visited, and to undo actions (we will learn how to apply this example when we discuss graphs and backtracking problems later in this book). The Java and C# programming languages use stacks to store variables and method calls and there is a stack overflow exception that can be thrown, especially when working with recursive algorithms (which we will cover later in this book as well).
Now that we know how to use the Stack class, let's use it to solve some computer science problems. In this section, we will cover the decimal to binary problem, where we will also transform the algorithm into a base converter algorithm.