CSCI 170 (GOLDWEBER)
Spring 08: 4/8/08
Homework 7: The Simple Computer
Due Date: Tuesday April 17, 2008.
There is a possible 20 points for this homework.
For all Simple Computer programs you write: Annotate your code. This means you should provide an explanatory comment for each line/block of code. Be algorithmically descriptive such as "increment loop counter by 1" as opposed to: load cell 42 into accumulator, add contents of cell 0 to accumulator, store contents of accumulator into cell 42...
Problem 1. (10 pts. FindSmallest) Using the Simple Computer demonstrated in class, implement the find smallest algorithm. Specifically, write a Simple Computer program that inputs n and then n values and outputs the smallest of the n values.
Problem 2. (10 pts.) Write a Simple Computer program that inputs positive integers a and b and outputs (a mod b).
Problem 3. (8 pts. Extra Credit) Write the Simple Computer program that implements the Sequential Search algorithm.
Problem 4. (10 pts. Extra Credit - Sorting) Implement the following using the Simple Computer: Using either selection sort or insertion sort, input ten values, sort them in descending order, and display them, in order on the output.
File translated from
TEX
by
TTH,
version 3.74.
On 8 Apr 2008, 09:38.