Exercises On Algorithmic Problem Solving: 600.106 Pre-Programming (Algorithmic Thinking)
Exercises On Algorithmic Problem Solving: 600.106 Pre-Programming (Algorithmic Thinking)
Instructions: Make a “structured plan” to face the following situations to the best of your
abilities (some exercises are already solved to serve as guide). Be clear and specific (see
the sample) and, whenever possible, write your algorithm in pseudocode.
Note: Only try those in which you feel confident, otherwise state the problem ot
confusion.
Definition of Goal: To explain to somebody how to center a title without using the direct action
key that centers the page.
Steps in order to achieve this goal: Method 1 (If using a Microsoft Word Document)
1.) Highlight all of the information you wish to center. This is done by clicking the mouse
directly in front of the first word, and then dragging it to the end. If done correctly, you will
notice that the background of the words will be a different color than the remainder of the
document.
2.) Click on the Format Tab (located at the top of the document; the Format tab should be the
fifth tab from the left).
3.) Locate the button that reads "Paragraph" (second from the top), and when highlighted, click
on it. Note: In this case, highlighting is accomplished by simply moving the mouse to a specific
location.
3.) The second section on the opening box will read "Indentation". Adjust the arrow keys on the
left and right accordingly, but it is important to be sure that both are equal in number. On the
bottom of the box is a demonstration of how the words will be formatted when using the
specified indentation.
4.) Click "OK" on the bottom of the box in order to execute the specified operations.
Note: If you want the remainder of the document to not follow the same indentation, move the
pointer to the end of the last word. Press "Enter" a few times (based on your judgment). Then
reformat the indentation by repeating steps 2-4
Begin
Read base
power = 1
For exponent = 1 to 3
power = power * base
Next
Write power
End
4) Suppose you have an old mechanical typewriter, with a page width of 60 caracters.
Your job is to put a new sheet of paper every time, and "perfectly" center at the top,
of the page, any message you are given. (Hint: Try seversal messages of different
length.)
5) Make a formula to compute the number of days before Christmas given any date.
Begin
Read base
Read height
If base = height then Write “square”
If base <> height then Write “rectangle”
End
7) Given the sides of a triangle, write an algorithm to determine its type.
9) Having a non-scientific calculator as your only tool, find the remainder of the division
of two numbers.
X Y
-6 -18.5
-4 -12.5
-2 -6.5
0 -0.5
2 5.5
4 11.5
6 17.5
11) Given the formula y = 0.5x2 - 3:
a) Describe the steps needed to get the list of Y-values, for a range of X-values
from –3 to +3.
b) Make a line graph of the resulting points.
X Y
12) For the sake of the argument, suppose that you have traveled back in time and
prevented your parents from meeting each other. Write down the paradox that follows
as a sequence of if-then statements.
13) You have been given a collection of points, like the ones shown in the typical puzzles
attached, and you have to send this information to a friend located far away from you.
Both of you have a communicating device which only allows you to send numbers
(no words or symbols at all). You know that, if the dots are connected, you get a
recognizable figure, but there is no way for you to send its name, only the points.
How can you transmit the very same sequence of points in such way that your friend
can reconstruct the figure?
14) During the summer you get a job as DJ at a small radio station that only plays
teenagers’ music. To make your program more attractive, you run a contest: you will
receive ten phone calls from the public, and afterwards, you will award a thoughtful
prize to the oldest member of your audience. Note the following: (i) you receive one
call at a time, (ii) you don not know when the next call will occur, (iii) you are not
allowed to disclose the age at any moment.
Think of a strategy to solve this situation, that’s it, finding the largest number without
having all the data beforehand.
15) Carefully inspect the following drawing and describe a step-by-step procedure to
draw it.