
Algorithmic Language
Lecture notes for Wednesday September 1st, 2004
Based on Schaum’s Outline book, chapter 2.
1. Yesterday’s Exercise – Think about the language that you used in your algorithms. How can
we make that more precise? Notice that each step contains a “verb” indicating what action to
be taken. The “objects” to act on are also indicated.
2. Steps in the exercise
a. Analyze the problem – understand the task that you wanted to solve (e.g how to measure
the size of a Lego piece)
b. Design a solution – worked with the “inputs” to find the process that would create the
expected “output”.
c. Test the solution – you tested with a variety of data to determine if the algorithm would
work for the different inputs.
d. We stopped here.
3. See example algorithm 2.2. (page 48)
a. input (the ingredients)
b. process (language structures and objects are specified)
c. output (the final sandwiches)
4. What structures are in this algorithm?
a. Sequence – we do step one before step two
b. Decision (also called selection) – we make a decision and use result to take an action or
not.
c. Repetition (also called iteration) – we repeat a number of steps to satisfy a condition.
d. These structures are represented in “pseudo code”.
Combination of Human-like and Computer language structures
5. Using Diagrams to express algorithms: Flowcharts. Compare 2.2 to 2.4 (page 49) for clarity.
a. Sequence is achieved by arrows between steps
b. Decision is described by a special symbol
c. Iteration is achieved by a decision and arrows.
d. What is the minimum number of sandwiches this algorithm may produce? How would
you change the algorithm so that we may produce NO sandwiches at all?
6. An additional structure is Abstraction. Pieces of a process can be separated from the main
process.
a. Example – from Tuesday lab.
b. Flowchart for exercise 2
7. Hierarchy charts (Fig 2-5 page 51) show the modules. Do not show the flow or exactly what
will be done, but allow us to break a task into its component parts.
a. See first-level ATM hierarchy chart.
b. See 2nd and 3rd-level hierarchy charts.