Question: a) Implement overloaded member functions called binSearchRec ,the recursive binSearchRec algorithm is presented in this chapter, starting on page 68 for an array of vehicles.
a) Implement overloaded member functions called binSearchRec,the recursive binSearchRec algorithm is presented in this chapter, starting on page 68 for an array of vehicles. Use a vector instead of an array.
- Sort by make then call a recursive function to do a binary search which lists out the make, model and year for the first year found (or report accordingly) that matches the for a user input.
then start a new sort
- Sort by model then call a recursive function to do a binary search which lists out the make, model and year for the first year found (or report accordingly) that matches the for a user input.
Read in the vehicles from a vehicle file (vehiclein.txt
) that has a year, make, and model. You have a choice of reading in an integer and two strings OR reading in 3 strings and converting the year to an int. Remember that between a stream operator (
b) Implement a member function with the same functional requirements, except instead of a recursive member function, use an iterative (non-recursive) binarySearchIter. Your iterative function (with loops instead of recursion) should produce the same results as your recursive function. You can place this member function in your recursion.h and recursion.cpp files.
The txt file inlcudes
2010 Ford Escape 2014 BMW 328xi 2014 BMW 428xi 2012 Ford Fusion SE 2014 Lamborghini Gallardo 1967 Pontiac GTO 1983 DeLorean DMC-12 1990 Audi 80 Sedan
USE of C++ language only
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
