
CMSI 182
INTRODUCTION TO COMPUTER SC I E N C E
Fall 2008
Assignment 0923
For this assignment, we make the transition from just thinking about algorithms informally to trying to get
machines to perform our algorithms for us. Yes, this is programming :)
Not for Submission
By September 11
1. Read the Pseudocode section of the Brookshear
textbook, pages 210–215.
2. Start writing “first drafts” of as many of our
three programmable algorithms (gymnastics
tiebreakers, diving scores, and the electoral col-
lege) using the pseudocode notation presented
in the textbook. Try to have at least one ready
for use in class on September 11.
By September 16
3. Try to complete and debug your pseudocode
drafts over the weekend.
4. Read up on JavaScript if you’d like to get a
head start for this week’s material.
By September 18
5. Convert as much of your pseudocode into
JavaScript, ready for review and debugging dur-
ing an upcoming lab session.
For Submission
Submit the following on hardcopy by the beginning
of class on September 23. To get the most out of
in-class activities and prevent cramming on Sep-
tember 22, follow the schedule on the left.
Exercise
Write up pseudocode and JavaScript versions of
the following algorithms:
1. Deciding a tiebreak between two sets of
Olympic gymnastics scores
2. Calculating a diving score, given a degree of
difficulty and a set of individual judge scores
3. Determining the winner of an electoral
college-style vote given the per-state popular
votes for each candidate
Reflection
Once you have finished the exercise, answer the
following reflection questions:
1. Before starting the pseudocode, how confident
were you that you could do all three algorithms
by hand?
2. What was it like to make yourself express these
algorithms in pseudocode? What made sense
to you, and what did not?
3. What was it like to get a machine to perform
these algorithms using JavaScript? What made
sense to you, and what did not?
Look up news items, articles, or data on the follow-
ing events, then answer the questions below:
•2008 Summer Olympics final results for the
women’s uneven bars
•2000 U.S. presidential election
4. What do these two events have in common, in
relation to their corresponding algorithms?
5. Based on these events, do you feel that these
algorithms can be improved? Are as good as
they can get? Express yourself freely.