Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include #include using namespace std;

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

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions

Question

How is the price determined for a bond (or bond issue)?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago