# Problem Solving

Problem solving is a crucial skill for computer scientist. Like any other skill, practice makes perfect. So the following exercises give you the opportunity.

For the following exercise, give a step-by-step (a bit like a cooking recipe) guide on how to solve the problem. Try to think about a solution yourself before you look on the Internet.

• Given a series of numbers in random order, you are asked to sort them in ascending order.
• Given a series of numbers in ascending order, you are asked to sort them in descending order.
• Given a series of numbers in random order, you are asked to find a specific number.
• Given a series of numbers in ascending order, you are asked to find a specific number
• Given two numbers X and Y, how would you print a tree with width X (9 in the example) and length X for the trunk (3 in the example)
```         *
***
*****
*******
*********
***
***
***
```
• how would you solve the towers of Hanoi puzzle
• how would you solve the n-queens puzzle

Marina De Vos 2008-07-12