# Problem Solving

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

For the following exercise, give a step-by-step (a bit like a cooking recipe) guide in natural language on how to solve the problem. Try to think about a solution yourself before you look on the Internet. To verify your solution, take an example and work your way through the steps yourself or ask a friend to go through the sequence. When programming, each of these steps will be translated in a programming statement.

If you do not know the puzzle that is mentioned, you can always find a description on the net.

• 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 2012-07-25