CS 111 Assignment 9This assignment will consist of practice problems only. There will be nothing to hand in. The purpose of this assignment is to help you prepare for the final exam.
- Files to print out and bring to lecture and recitation
- Preparations before you begin your homework
- Practice problems
For information about the due dates, including late dates and extra-credit early due dates, please see Homework policies and due dates.
- Files to print out and bring to lecture and recitation
Below are tutorials and example programs and data files. Please make printouts of these and bring them with you to both lecture and recitation. However, please do NOT print them out in an on-campus lab. (On-campus printers are to be used only for your homework, i.e. for files YOU wrote.) If you do not have a computer at home, with a printer, ask a friend or classmate to print out copies of the following files for you.
Below are example programs. Note that arrayDemoIterative.cpp and arrayDemoRecursive.cpp contain code for the search and sort algorithms on which you'll be tested on the final exam.
- arrayDemo.h
- arrayDemoIterative.cpp
- arrayDemoRecursive.cpp
- testReverse1.cpp
- testReverse2.cpp
- pointers1.cpp
- pointers2.cpp
- pointers3.cpp
Regarding pointers, see Skansholm, sections 5.4.1, 5.4.2, and 5.4.3, and review the material in the following tutorials on arrays as parameters to functions:
- Assignment 6: One-dimensional arrays (including C-strings) as parameters to functions
- Assignment 8: Tutorial on two-dimensional arrays
- Assignment 8: Tutorial on recursion
Regarding linear search and binary search, see Skansholm, pp. 63, 116, and 166. Selection sort was covered in lecture, NOT in the textbook. Here is a brief tutorial:
On forbin, create a directory named hw09 inside your homework directory. Change your present working directory to hw09 and then copy into it the example files for this homework assignment, by typing, at the "forbin>" prompt:
cp ~nixon/cs111/hw09/* .Please do NOT copy these files into your home directory, to avoid cluttering your home directory. If you inadvertantly copied them into your home directory, move them out using the mv command. Be very careful about deleting anything in your home directory, to avoid inadvertantly deleting your hidden files (.login, .cshrc, .profile, etc.).
- Practice problems
For each of the following programs, look at the source code and write, on paper, what you think its output will be. Then run the program to verify that the output is what you expected.
Back to: