COMPSCI 187
Programming with Data Structures
Programming with Data Structures
This week we will be focusing on the idea of Recursion. We will look at why recursion is important and how it can be used to solve problems that could be more difficult to solve iteratively. Recursion is an elegant way of expressing algorithms to certain types of problems. It is not suited to all problems and it can often lead to poor performance – yet provide a deep understanding to the problem at hand. So, why study recursion at all? The reason why we look at recursion is because it provides a window into looking at how to solve problems from a different perspective. In particular, it focuses on solving problems through a common technique known as divide and conquer. That is, we solve a problem by trying to solve smaller sub-problems. In the case of recursion, it happens to be trying to solve the same problem in smaller parts.