Function that returns the height of a binary tree

Assignment Help C/C++ Programming
Reference no: EM1390370

Task 1: Fill out Survey

Please take the 122/223 survey at survey.osble.org/index.php?sid=97282. Please treat the question asking about 122 as if it were asking about taking 223. Note that this survey is different from the end of semester course evaluation survey. When you finish this survey, please have the TA check you off.

Task 2: Binary Search Tree Exercises

In the past, students often feel conceptually comfortable with BSTs, but often have difficulties actually using them in code. The following mini exercises are intended to give you exposure to working with BSTs in code. Inside of the BinarySearchTree class (look for the TODO items), complete the following functions:

1. Write a function called getHeight() that returns the height of a given binary tree.
a. Recall that the height is simply the maximum depth of the tree.

2. Write a function called getNumberOfLeafNodes() that returns the number of leaf nodes in the tree

3. Write a function called countSmallerThan() that returns the number of nodes whose values are smaller than the supplied input paramter

4. Write a function called outputRange() that returns, in sorted order, a string of nodes whose values are between a supplied range.

Sample Output

1332_sample output.png


Download:- starter_code.rar

Reference no: EM1390370

Questions Cloud

Probability on randomly selected phone number : The first three digits of a university telphone exchange are 452. if all the sequences of the remaining four digits are equally likely, what is the probability that a randomly selected universtiy phone number contains seven distinct digits?
Explain the levels of protein structure : Enzymes and proteins are essential to living organisms and function of a protein is dependent upon its structure. Discuss and describe the four levels of protein structure.
Calculate the overall proportion of tourists : Calculate the overall proportion of "tourists" (cars with out-of-state plates). b. Calculate the LCL and UCL for these data
Monte carlo simulation used to derive p-value for a cluster : Where does the p-value come from for the spatial scan statistic used in SaTScan? Explain how Monte Carlo simulation is used to derive a p-value for a cluster.
Function that returns the height of a binary tree : Write a function called getHeight() that returns the height of a given binary tree - CptS 122 Write a function called countSmallerThan() that returns the number of nodes whose values are smaller than the supplied input paramter
Estimate solute in the resulting solution : Molly requires to make one liter of a 1.5 M glucose solution for use in an experiment. The molar mass of glucose is 180.16 g/mol.
Calculate upper and lower control limits : Calculate upper and lower control limits for both sample means and ranges. Is this process in control? Explain--a simple Yes or No is insufficient
Explain different microbial groups in anaerobic digester : Describe what are the three different microbial groups in anaerobic digester, and how they work together to convert complex polymers to methane gas.
Probability of a right-handed golf player : A box of nine golf gloves contains two left-handed and seven right-handed ... box without replacement, what is the probability that- (X) both gloves are right handed and (Y) one left-handed and one ... If two gloves are randomly selected with repl..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Base process which communicate with child processes

Write a program which has a "base process" which communicates with child processes acting as "bombers" that it creates.

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Write c program which has parent process and child process

Write a C program that has a parent process, a child process, and a grandchild process. The parent process should print its id and the square or 5.

  Loops and if conditions

Write a program that requests a password

  Assign passed value to function to return value

Assign passed value to this member and another function to return value. Your main should read the integer from an input data file, and write the output to the output data file.

  Program to add numbers and display sum

For each of problems write C++ code to do the required task. Receive the number and find out whether it is odd or even.

  Describe the probability of the moves

Write a program in C++ to describe the Probability of the moves

  Write c function to sort one dimensional integer array

Consider the values sorted in the array. Sort it in ascending order using Bubble sort technique showing all iterations: write C function to sort one dimensional integer array in ascending order.

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

  Programmingto compute the volume of water in the cubic feet

Write down an algorithm (Programming in C) in order to compute the volume of water in the cubic feet, flowing through a pipe of diameter d in feet, having a velocity of v feet per second.

  Write recursive boolean method to accept array and value

Write down the recursive boolean method named isMember. The method must accept two arguments: an array and a value. Method must return true if value is found in array.

  Prepare an accounting for a dorm''s kitchen

The "purpose" of the program is to prepare an accounting (database) for e.g. a dorm's kitchen, to keep track of the consumption of beer for each room.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd