Question: Write a C++ program that has an array of 20 integers. It should call a function that uses the linear search algorithm to locate one
Write a C++ program that has an array of 20 integers. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should keep count of the number of comparisons it makes. Display the values on the screen.
Using the following values: 101, 142, 147, 189, 199, 207, 222, 234, 289, 296, 310, 319, 388, 394, 417, 429, 447, 521, 536, 600
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
