






| |
Due Date: Announced in Class / check
e-mail/briefcase.com |
50 Points |
You have started this assignment in class. You are to complete the following:
After reviewing Chapter 13 once again respond:
Exam Preparation Exercises on page 795
 | Question 2 . You are to write the function Search2
(IsPresent)(page 753) code in C++ and use the values described to indicate how many comparisons are
required to find the numbers 28, 32, 196, 194. Try to follow this procedure by hand first.
It will be easier to evaluate the logical accuracy of your program before its
implementation. |
The output: (the values don not have to be output all at the same time) indicate if I
have to change the value of item on your program. But, I would prefer if
a nice table like the one below is done by your program.
The ? are the values that you are going to find out after running your program
Search item |
Comparisons |
28 |
? |
32 |
? |
196 |
? |
194 |
? |
 | Question 3. At this time you will use the same data but apply the
Sequential search function instead, on page on (page 764). |
The output: (the values don't have to be output all at the same time) indicate if I
have to change the value of item on your program. But, I would prefer if
a nice table like the one below is created by your program.
The ? are the values that you are going to find out after running your program
Search item |
Comparisons |
28 |
? |
32 |
? |
196 |
? |
194 |
? |
 | Question 4. You are to apply the function BinSearch
(page 766) to find item 114. You are to create the program in C++ and trace the values of
the variables first, last and middle
and show their values until 114 is found. There is no need to identify the undefined
values with a U as stated on the exercise. |
The output:
The ? are the values that you are going to find out after running your program
item |
first |
last |
middle |
|
114 |
? |
? |
? |
|
? |
? |
? |
? |
? |
? |
found = TRUE |
Turn in:
 | You have to turn in Three separate pages. Each page with the code for Questions 2 , 3
and 4. Include on this page the answer for the questions. |
 | You can retrieve your c++ source code files using a text editor and type your answers at
the end. |
 | Submit a floppy disk with all three programs. |
 | Put all in an envelope and submit it to your instructor. |
|