Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you will be given the following files: File Name Description assg05-tests.cpp Unit tests for the two functions you are to write. assg05-search.hpp

image text in transcribedimage text in transcribed

For this assignment you will be given the following files: File Name Description assg05-tests.cpp Unit tests for the two functions you are to write. assg05-search.hpp Header file for function prototypes you are to add. assg05-search.cpp Implementation file for the functions you are to write for this assignment. Set up a multi-file project to compile the two .cpp source files together and run them as shown for the class. The Makefile you were given should be configure to build a project using the VS Code editor as required in this class. The general approach you should take for this assignment, and all assignment is: 1. Set up your project with the given starting templates. The files should compile and run, but either no tests will be run, or tests will run but be failing. 2. For this project, start by uncommenting the first TEST_CASE in the assg05-tests.cpp file. These are the unit tests of the sequentialSearchRecursive() function you are to write. When you uncomment this first unit test case, your program will no longer be able to compile, because you have not yet written the sequentialSearchRecursive () function. 2 3. Add the correct function prototype for your sequentialSearchRecursive () function to the assg01-search.hpp header file. The prototype consists of the name of the function, its input parameters and their types, and the return value of the function. 4. Add a stub/empty implementation of sequentialSearchRecursive() to your own assg05-search.cpp imple- mentation file. The function should have the same signature as the prototype you gave in the header file. The function should initially just return a result of NOT_FOUND since this is a value returning function that should return an integer index or the NOT_FOUND flag to indicate unsuccessful search.. 4. Add a stub/empty implementation of sequentialSearchRecursive() to your own assg05-search.cpp imple- mentation file. The function should have the same signature as the prototype you gave in the header file. The function should initially just return a result of NOT_FOUND since this is a value returning function that should return an integer index or the NOT_FOUND flag to indicate unsuccessful search.. 5. Your code should compile and run now. Make sure after adding the function prototype and stub your code compiles and runs. However, some but not all of the unit tests will now be passing, and most will be failing. 6. Incrementally implement the functionality of your sequentialSearchRecursive() function. You should try to add no more than 2 or 3 lines of code, and then make sure you program still compiles and runs. You can start by adding in the base cases 1 at a time, then add in the general case. 7. Once you have the sequentialSearchRecursive () function implemented and all unit tests passing, you should then move on to the binarySearchRecursive() function. Your approach should be the same. Start by uncommenting the second TEST_CASE and making sure code still compiles after adding your function prototype to the header file and a stub/empty function to the implementation file. Then incrementally add code to this function, recompiling often and paying attention to which unit tests are passing and which are failing while implementing the function. Tasks You should set up your project/code as described in the previous section. In this section we give some more details on implementing the two functions you are to write for this assignment. You should perform the following tasks for this assignment, once you have your project set up and building: 1. Implement the function named sequentialSearchRecursive(). You should have a stub of the function that compiles and runs the tests, but fails because it returns NOT_FOUND by default. This function takes 4 parameters as inputs, and you can see from the test cases what the expected function signature needs to be. Add in the base cases and the recursive case incrementally until all of the tests are passing for the first test case. 2. Implement the function named binarySearchRecursive(). You should already have a stub of this function that compiles and returns a result of NOT_FOUND before starting to implement the function. This function takes the same 4 parameters as the first function. Add in the base cases and the two recursive cases this time until all of the tests are passing for the second test case. For this assignment you will be given the following files: File Name Description assg05-tests.cpp Unit tests for the two functions you are to write. assg05-search.hpp Header file for function prototypes you are to add. assg05-search.cpp Implementation file for the functions you are to write for this assignment. Set up a multi-file project to compile the two .cpp source files together and run them as shown for the class. The Makefile you were given should be configure to build a project using the VS Code editor as required in this class. The general approach you should take for this assignment, and all assignment is: 1. Set up your project with the given starting templates. The files should compile and run, but either no tests will be run, or tests will run but be failing. 2. For this project, start by uncommenting the first TEST_CASE in the assg05-tests.cpp file. These are the unit tests of the sequentialSearchRecursive() function you are to write. When you uncomment this first unit test case, your program will no longer be able to compile, because you have not yet written the sequentialSearchRecursive () function. 2 3. Add the correct function prototype for your sequentialSearchRecursive () function to the assg01-search.hpp header file. The prototype consists of the name of the function, its input parameters and their types, and the return value of the function. 4. Add a stub/empty implementation of sequentialSearchRecursive() to your own assg05-search.cpp imple- mentation file. The function should have the same signature as the prototype you gave in the header file. The function should initially just return a result of NOT_FOUND since this is a value returning function that should return an integer index or the NOT_FOUND flag to indicate unsuccessful search.. 4. Add a stub/empty implementation of sequentialSearchRecursive() to your own assg05-search.cpp imple- mentation file. The function should have the same signature as the prototype you gave in the header file. The function should initially just return a result of NOT_FOUND since this is a value returning function that should return an integer index or the NOT_FOUND flag to indicate unsuccessful search.. 5. Your code should compile and run now. Make sure after adding the function prototype and stub your code compiles and runs. However, some but not all of the unit tests will now be passing, and most will be failing. 6. Incrementally implement the functionality of your sequentialSearchRecursive() function. You should try to add no more than 2 or 3 lines of code, and then make sure you program still compiles and runs. You can start by adding in the base cases 1 at a time, then add in the general case. 7. Once you have the sequentialSearchRecursive () function implemented and all unit tests passing, you should then move on to the binarySearchRecursive() function. Your approach should be the same. Start by uncommenting the second TEST_CASE and making sure code still compiles after adding your function prototype to the header file and a stub/empty function to the implementation file. Then incrementally add code to this function, recompiling often and paying attention to which unit tests are passing and which are failing while implementing the function. Tasks You should set up your project/code as described in the previous section. In this section we give some more details on implementing the two functions you are to write for this assignment. You should perform the following tasks for this assignment, once you have your project set up and building: 1. Implement the function named sequentialSearchRecursive(). You should have a stub of the function that compiles and runs the tests, but fails because it returns NOT_FOUND by default. This function takes 4 parameters as inputs, and you can see from the test cases what the expected function signature needs to be. Add in the base cases and the recursive case incrementally until all of the tests are passing for the first test case. 2. Implement the function named binarySearchRecursive(). You should already have a stub of this function that compiles and returns a result of NOT_FOUND before starting to implement the function. This function takes the same 4 parameters as the first function. Add in the base cases and the two recursive cases this time until all of the tests are passing for the second test case

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

What is a cost object?

Answered: 1 week ago

Question

Solve for x: 2(3x 1)2(x + 5) = 12

Answered: 1 week ago

Question

Trudy, when she first saw the bull pawing the ground, ran.

Answered: 1 week ago