Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Recursion vs Iterative functions. For this assignment you will make a Recurs

ID: 3787936 • Letter: C

Question

C++

Recursion vs Iterative functions.

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

a) Implement the recursive binSearchRec algorithm presented in this chapter, starting on page 68 for a vector of vehicles.

Sort by year then call a recursive function to do a binary search which lists out all vehicle information for a user input year.

then

Sort by make then call a recursive function to do a binary search which lists out all vehicle information for a user input make.

then

Sort by model then call a recursive function to do a binary search which lists out all vehicle information for a user input model.

Then do these same 3 Searches for an input (year, make, model), but use loops instead of a recursive function.

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 should produce the same results as your recursive function.

This is the file for vehiclein.txt

2010
Ford
Escape
|
2014
BMW
328xi
|
2014
BMW
428xi
|
2012
Ford
Fusion SE
|
2014
Lamborghini
Gallardo
|

Explanation / Answer

#include // std::cout #include // std::binary_search, std::sort #include // std::vector bool myfunction (int i,int j) { return (i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote