Menu

[Solved] C Programming Project Practice Template Class Function Pointers Recursion Binary Search Tr Q37289013

C++ PROGRAMMING

In this project, you will practice template class, functionpointers, and recursion with the binary search tree program. Therequirements are as follows.

Binary_tree.h

  1. Implement operator=() by using pointer swapping technique.
  2. Implement the following member functions by usingrecursion
  • ~Binary_tree():
  • recursive_preorder()
  • recursive_inorder()
  • recursive_postorder()
  • recursive_height()
  1. Add the following public member function
    1. int getLeafCount()

Search_tree.h

  1. Implement search_and_insert()
  2. Implement search_and_delete() with immediate predecessorapproach

main.cpp

  1. Add menu items for three traversals
  2. Add a menu item for computing leaf count.
  3. Create a function named increase withthe following signature and use it as a visit function for threetraversal methods.

void increase(int);

The increase() will increase the value of data of a node by 1,as the function applies to each node.

  1. Running and testing your program in the following order andtake screenshots for each step.
  1. Build a binary search tree with the following keys in order:20, 10, 15, 40, 18, 30, 80, 35, 60, 90, 5, 7, 1, print the tree,and print the leaf count and height.
  2. Delete 30 and print the tree
  3. Delete 20 and print the tree and leaf count
  4. Print the result of pre-order traversal after applyingincrease() as a visit function.
  5. Print the result of in-order traversal after applyingincrease() as a visit function.
  6. Print the result of post-order traversal after applyingincrease() as a visit function.

Expert Answer


Answer to C++ PROGRAMMING In this project, you will practice template class, function pointers, and recursion with the binary sear… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *