CISC 181 Introduction to Computer Science, Fall, 1998

Nov 2 Lab project -- Examples with recursion and arrays/pointers

  1. To do in lab

    Make a copy in your directory of 181/lab8/search.cc. This contains the linear and binary search examples, with the binary search converted to the use of pointers instead of array indexing. Convert the linear search to the direct use of pointers in the same fashion. Test your version with some sample runs. Print and submit the code at the end of lab. You do not have to submit any test data, just code. If your code does not run, handwrite a brief explanation of the problem you are having on the printout.

  2. Computing assignment for next week. Due Monday, Nov 9, in lab.

    Do any two of the following 7 recursion exercises from chapter 4, page 281:
    4.31
    4.32
    4.33 - it can be a recursive version using either array indexing or direct pointers.
    4.35
    4.36 - you may assume the entries in the array are int's (or better yet, make printArray a template function). printArray prints the entries in order to cout, separated by spaces and ended by a newline character.
    4.37
    4.38

    Make a main function which tests your solutions on some data. Hand in a printout of your code and also a printout of a session of test runs. You can use script.