CSc 11: Introduction to Computing
Assignment #7 (Chapters 11 and 12)

Write answers to the following exercises, found in the textbook: 11.4, 11.6, 11.9, 11.18, 11.21, 11.31, 11.35, 12.3, 12.18.
Design and implement programs that solve the problems posed in exercises in the textbook: 11.12, 11.29 and 11.37. (For 11.37, you may start with selsort.cc; comment your code to explain the changes you make.) Write a write a main() test driver function that tests your functions in different ways.)

Extra credit: 11.25, 11.27.

Due: Tuesday, 11/21, anytime before midnight. When you're ready to submit your assignment, combine the answers to all the exercises (including source code for the programming exercises. Then, using a web browser, go to The Student Drop Box for Introduction to Computing. (It's under Student Tools.) Click on the Browse button, then find your files in their folder (if you put it on a floppy disk, it's in A:). When you've selected your file, you should see a directory path to this file next to the Browse button. If it looks right to you, click on the Send File to Instructor button. Then you should see this file listed under Current Files in your DropBox. The Teaching Assistant, Jeff Eynon (jne3), will get this file and grade it.

Hints:
Exercise 11.31 is discussing the test in function LinearSearch(), which says while(i < lastValue). Think about what would happen, using the test proposed in the exercise, if one were searching for an string that is not in the array.

Exercise 11.37. How do you construct an array that consists of numerous Lstrings?
You use class StringArray, which is an array of Lstrings (rather than, say, an array of ints). You can then assign an Lstring to each element of the array. The Lstrings may either be supplied by a user or (a bit less interestingly) hardcoded into your program. I don't see any need for any special delimiters (note spelling). If you are reading Lstrings from a user, a space or newline separates each Lstring.

Exercise 12.18 is about orders of magnitude ("Big O"). I will be discussing orders of magnitude in lecture next week. Briefly, an order of magnitude is a way of measuring the size of some quantity in terms of powers of ten. For example, if program (a) requires 1000 bytes of memory and program (b) requires 100,000 bytes of memory, then program (b) requires 100 times as much memory as program (a), or two orders of magnitudes, since 100 is ten squared. Or if algorithm (x) takes 88 cycles and algorithm (y) takes 970 cycles to run, then (y) takes roughly one order of magnitude longer. Note that in the second example shows that orders of magnitude measurements be approximate, since a power of ten swamps out small numbers: 970 is roughly 10 times 88. Also notice that orders of magnitude can measure any quantity, such as size, speed, or number of possible permutations.

Prof. Blank