Write recursive function for binary search tree

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

Use the attached Binary Search Tree template (BST.h) for the following exercises.

1. Write a recursive member function level() for class template BST(Binary Search Tree) that determines the level in the BST at which a specified item is located. The root of the BST is at level 0, its children are at level 1, and so on.

2. Write a recursive member function leafCount() for class template BST to count the leaves in a binary tree.
[Hint: How is the number of leaves in the entire tree related to the number of leaves in the left and right subtrees of that root?]

Attachment:- BST.zip

Reference no: EM13937791

Questions Cloud

What output should be produced : What output should be produced? What will be the price? How much profit is made? If the firm can change plant size and move into the long run, what will be output and price?
Virgin australia online air ticketing system : The ticketing system must be Virgin Australia Online Air Ticketing system answer all 6 question apa reference 3 user must have 3 scenario each which is 9You are required to analyze the effectiveness of the Virgin: Australia online Air ticketing sy..
Find amount of depreciation expense related to the computer : Calculate the amount of depreciation expense related to the computer system Hallmark will report on its income statement for the fiscal year ended June 30, 2009, for each scenario.
Recalculate your answer to part b assuming : Recalculate your answer to part b assuming Marie can lower the amount paid to instructors to $3,500 per class. Should Marie seriously pursue this option?
Write recursive function for binary search tree : Write a recursive member function level() for class template BST(Binary Search Tree) that determines the level in the BST at which a specified item is located. The root of the BST is at level 0, its children are at level 1, and so on.
How does the graph display this information : How it is possible for the price of the superstar's autographs to be higher than the price of the teammate's autographs even though the supply of superstar autographs is larger than the supply of teammate autographs? How does the graph display thi..
What was the gain or loss on the sale : What was the gain or loss on the sale? On which financial statement would the gain or loss appear? What information does this accounting calculation provide for future decisions?
Type of structure-frame structure system : There are different types of frame system which are having combination beams(which is called horizontal element) , column (which is called vertical element)  and slab to hold the lateral and gravity, types of frame structure:-
Prepare a number of financial reports : Perdisco can then give you feedback that will help you identify and fix your mistakes as early as possible to prevent those mistakes being carried forward throughout the rest of your practice set.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Clears the screen

Assignment: Write a script that meets the following requirements:•Clears the screen•Creates the menu displayed below with any additional formatting you may desire•Prompts the user to choose a menu option•Assigns the value chosen by the user to the va..

  Write a c program that will calculate the gross pay

Write a C program that will calculate the gross pay of a set of employees. For each employee the program should prompt the user to enter the clock number, wage rate, and number of hours as shown below.

  Repare a c++ class derived that inherits from base class

Write a C++ class Base has two member functions: //add constructor(s) if needed int f () {return x*25;} //x is a protected data member of Base class virtual int g() {return x *35; }

  Write a for loop that displays the following set of numbers

Write a for loop that displays the following set of numbers 0, 5, 10, 15, 20, 25 ...... 500.

  The function should return a value

The function should return a value of 1 when it is given a valid score to process and 0 when the received value is out side of the 0-10 range. In this case it should print a waring message on the screen

  Calculate the net pay as the gross less the taxes

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference.

  Write a matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  Interpret the data and information gathered

To at least 10 people (learners and parents) to gather data, that could, through analysis provide answers Analyse and interpret the data and information gathered; Write a report based on your investigation; and Prepare a presentation to present the..

  Write a function for upper triangular matrix

Write a function 'function x = u solve(A,b)' to solve Ax = b when 'A' is a upper triangular matrix.

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  Write a function name is prime

Write a function name is Prime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Demonstrate the function in a complete program.

  Design a nested program

How many levels of nesting are there in this design?

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