subject

Here you'll write the inorder traversal function in the header file "bst. h". notice that the public inorder function calls a private recursive function _ inorder to do the actual traversal. this public-private strategy is the correct way to implement recursive functions, where the public function kicks off the recursion and the private function does the actual work. the public function is written for you, your job is to implement the private _ inorder function. he main program has been written to input a sequence of integers and build a binary search tree, which you can then output. the input sequence is followed by a negative sentinel. here's an example program run: 5025881040999-1size: 6inorder: 10 25 40 50 88 999your job is to produce that last line of output, the inorder traversal of the tree with output to cout. main. cpp is a read only file#include #include "bst. h"using namespace std; int main(){binarysearchtree tree; int key; 1. inputs values from the keyboard and builds a binary search tree; // reads input until the sentinel (a negative value) is input. the// resulting binary search tree is returned.//cin > > key; while (key > = 0){tree. insert(key); cin > > key; } 2. output size and contents (in order): //cout < < "size: " < < tree. size() < < endl; tree. inorder(); // done: return 0; }bsh. h is the file to work on./*bsh. h* binary search tree//#pragma once#include using namespace std; templateclass binarysearchtree{private: struct node{tkey key; node* left; node* right; }; node* root; // pointer to root node of tree (nullptr if empty)int size; // # of nodes in the tree (0 if empty) _inorder does the actual inorder traversal and output// to console. each key is output to the console followed// by " ", including the last key.//void _inorder(node* cur){ todo: //}public: default constructor: creates an empty tree.//binarysearchtree(){root = nullptr; size = 0; } size: returns the # of nodes in the tree, 0 if empty.//int size(){return size; } inorder: performs an inorder traversal of the tree, outputting// the keys to the console.//void inorder(){cout < < "inorder: "; _inorder(root); cout < < endl; }};

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
How should you specify box sizes on a web page if you want the boxes to vary according to the font size of the text they contain? a. in pixels b. in inches c. as percentages d. in em units
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
1. which of the following is not an example of an objective question? a. multiple choice. b. essay. c. true/false. d. matching 2. why is it important to recognize the key word in the essay question? a. it will provide the answer to the essay. b. it will show you a friend's answer. c. it will provide you time to look for the answer. d. it will guide you on which kind of answer is required.
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
You know the right answer?
Here you'll write the inorder traversal function in the header file "bst. h". notice that the public...
Questions
question
Mathematics, 30.07.2021 17:50
question
Chemistry, 30.07.2021 17:50
question
Mathematics, 30.07.2021 17:50
Questions on the website: 13722361