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, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 22.06.2019 11:00
What are two of the most common reasons that peolpe who need mental health care do not access it?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When using a public computer or network, you should always
Answers: 2
question
Computers and Technology, 23.06.2019 01:40
You have a linux system that has a 1000gb hard disk drive, which has a 90gb partition containing an ext4 filesystem mounted to the / directory and a 4gb swap partition. currently, this linux system is only used by a few users for storing small files; however, the department manager wants to upgrade this system and use it to run a database application that will be used by 100 users. the database application and the associated data will take up over 200gb of hard disk space. in addition, these 100 users will store their personal files on the hard disk of the system. each user must have a maximum of 5gb of storage space. the department manager has made it very clear that this system must not exhibit any downtime as a result of hard disk errors. how much hard disk space will you require, and what partitions would you need to ensure that the system will perform as needed? where would these partitions be mounted? what quotas would you implement? what commands would you need to run and what entries to /etc/fstab would you need to create? justify your answers.
Answers: 3
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
Social Studies, 24.08.2019 14:00
question
Social Studies, 24.08.2019 14:00
question
Social Studies, 24.08.2019 14:00
question
Mathematics, 24.08.2019 14:00