Blog


Management No Comments

Incrementally implement the functionality of r insert

Incrementally implement the functionality of r insert

Set up your project with the given starting code. 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 assg11-tests.cpp file. These are the unit

tests to test the functionality of your BinaryTree insert() function, the class recursive method you are to

implement.

1

3. Add the insert() public and private prototypes to the BinaryTree.hpp header file.

4. Add a stub for your two insert() member function to the BinaryTree.cpp implementation file. The public

insert() is a void function so it can initially be empty. The private version of the function should return a

pointer to a BinaryTreeNode, so you should create a new node and return it initially from this function.

5. Your code should compile and run now. Make sure after adding the public and private stub methods your code

compiles and runs. However, your unit tests will be failing initially.

6. Incrementally implement the functionality of your insert() member functions. Most of the work is actually

done by the private insert() function. You should try to add no more than 2 or 3 lines of code, and then

make sure your program still compiles and runs. Start by adding code to get the first failing test to pass. Then

once that test passes, move on to the next failing tests until you have all tests passing. If you write something

that causes a previously passing test to fail, you should stop and figure out why, and either fix it so that the

original test still passes, or remove what you did and try a new approach.

7. Once you have the insert() member function implemented and all unit tests passing, you should then move

on to the other functions in the order suggested. Some functions use previous ones in this assignment, so do

them in the order given for you in the tasks below.

Comments are closed.

Instant Homwork Help
Need Help? Whatsapp a Tutor