Question: C++ code: Recursion vs Iterative functions. For this assignment you will make a Recursion class with two recursive member functions. a) Implement overloaded member functions

C++ code:

Recursion vs Iterative functions.

For this assignment you will make a Recursion class with two recursive member functions.

a) Implement overloaded member functions called binSearchRec the recursive binSearchRec algorithm presented in this chapter, starting on page 68 for an array of vehicles. Use a vector instead of an array.

- Sort by year 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

- 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

- 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.txtC++ code: Recursion vs Iterative functions. For this assignment you will makea Recursion class with two recursive member functions. a) Implement overloaded member) that has a year, make, and model. Each vehicle is separated with a | (straight bar) on it's own line. (Note that make and models might have spaces in them)

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.

You will need 4 files: main.cpp, recursion.cpp, recursion.h and vehiclein.txt plus your readme.txt and makefile all zipped together

vehiclein.txt file:

2010

Ford

Escape

|

2014

BMW

328xi

|

2014

BMW

428xi

|

2012

Ford

Fusion SE

|

2014

Lamborghini

Gallardo

|

pg 68:

functions called binSearchRec the recursive binSearchRec algorithm presented in this chapter, starting

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!