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

  Public transport fare ticketing system

Implement and test a public transport fare ticketing system.

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  A hierarchical jpeg encode decoder for greyscale images

This project is to develop a program that implements a hierarchical JPEG encoder/decoder for greyscale images.

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

  Write program to calculate net pay for factory worker

Write and run a program in C++ that calculates the net pay for a factory worker. The program prompts the user for skill level and hours worked, as well as appropriate insurance and retirement options for the employee's skill.

  Array of integers declared-initialized to number of tickets

Array of integers named parkingTickets has been declared and initialized to number of parking tickets given out by city police each day as beginning of current year.

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  Why does the neverwet spray protect it from water

As is know, acetone is a polar molecule like water, so isn't it suppose to mix? So my question is: why does the Neverwet spray protect it from water but not from oils and detergents?

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

  To reverse the order of elements on a stack

Write a program in C++ to  reverse the order of elements on a stack S using two additional stacks using one additional stack

  Prepare a program that uses at least two functions

Prepare a program that uses at least two functions that can be called from your main.

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