Question: Simple C++ codes please. In this program, you will implement the deceptively simple (and amazingly efficient) Binary Search algorithm. What you need to do: .

 Simple C++ codes please. In this program, you will implement the

Simple C++ codes please.

In this program, you will implement the deceptively simple (and amazingly efficient) Binary Search algorithm. What you need to do: . Your program should accept a single command-line parameter, which is the name of the file to read. If the user forgets the command-line parameter, or if the file cannot be found your program should report an appropriate error message. The input format is the same as the previous assignment, except that the data is sorted, Just like for the previous program, your program should print out: 1. the name, age, job title, and hire date of each individual that is looked up 2. how many comparisons you had to perform to find that individual 3. After all the queries are finished print out the average number of comparisons that your program had to do, per query. HINT: I suggest using a double variable to store the average. For full credit your program must implement the textbook's pseudocode for binary Search: BINARY-SEARCH(X, Tp.r) 1 low =p 2 high = max(p.r + 1) 3 while low

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!