Question
In C++, you will need to write the following three functions in table.cpp, and add function prototypes for them to table.h. File supplied.o contains code
In C++, you will need to write the following three functions in table.cpp, and add function prototypes for them to table.h. File supplied.o contains code that can build, display, duplicate, and destroy a binary search tree
int count(node * root) Recursively compute and return the number of nodes in the bst.
int sum(node * root) Recursively compute and return the sum of the ints contained in the bst.
int height(node * root) Recursively compute and return the height of the bst
-----------------------
Given:
---------
table.h
//list.h #include
struct node { int data; node * left; node * right;; };
void build(node * & root); //supplied void display(node * root); //supplied void destroy(node * & root); //supplied
/* ************** PLACE YOUR PROTOTYPE HERE ***************** */
----------------
main.cpp
#include "table.h"
#include
using namespace std;
int main() { node * root = NULL; build(root); display(root);
/* PLACE YOUR FUNCTION CALL HERE */
display(root); destroy(root); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started