Reads a set of integers from file

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

The code in file "hw5-stree.cpp" reads a set of integers from file and inserts them into a binary search tree. You are asked to implement two functions max() and depth() that compute the maximum element and the depth of the binary search tree. The function prototypes are given in file "d_stree.h" lines 174-212. You need to complete the implementation of these four functions so that max() return an iterator pointing to the maximum tree node, and depth() returns an integer indicating the depth of the tree. Note that all you need to do is to complete the implementation of the two functions computeDepth() and maxNode(). The max() and depth() functions call these two functions.

The provided code also computes the depth of the complete binary search tree with the same number of nodes. You are asked to run the code with different numbers of tree nodes, summarize your results in a table, and analyze your results based on our classroom discussions.

If you compiled your code with

g++ hw5-stree.cpp -o stree

you can use for example

./stree 1000

to read the first 1000 integers and build the tree.

 

 

Reference no: EM13166150

Questions Cloud

Create a computer class : Create a computer class and assume computers have the following fields: String manufacture, double price, int year
Compute the molar solubility of caco3 : Calculate the molar solubility of CaCO3 ( Ksp = 4.5*10-9) neglecting the acid-base character
Linked list in c++ : If the following C++ code is valid, show the output. If it is invalid, explain why.
State combustion in oxygen to make carbon dioxide gas : Methanol undergoes combustion in oxygen to make Carbon Dioxide Gas & Liquid Water. Find Standard Enthalpy of Reaction?
Reads a set of integers from file : The code in file "hw5-stree.cpp" reads a set of integers from file and inserts them into a binary search tree. You are asked to implement two functions max() and depth() that compute the maximum element and the depth of the binary search tree.
Vanilla versions versus best practices–based software : Compare and contrast customized and packaged software as well as vanilla versions versus best practices–based software.
Implement a client program : Implement a client program with a main method to demonstrate the evolution of the sales tax rates in the 50 US states over the last 10 years. Declare a two-dimensional array of values representing the sales tax rates. Dimension 1 represents the st..
Draw a two-dimensional house seen from the front : Draw a two-dimensional house seen from the front, the way a child would: with a dor, two windows, and a roof with a chimney
Calculates the average of three test scores : Write a program that calculates the average of three test scores. The program should contain three value-returning functions: main, getTestScore, and calcAverage

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Two types of constructors

Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..

  Repeat these questions by writing functions

Repeat these questions by writing functions that receive the arrays as constant reference parameters and return the appropriate values through the function name (via return statement). The function header could look like:

  Write program which prompts user to enter numbers

Write down the program which prompts the user to enter numbers, findsout how many positive and negative values have been entered, and calculates sum and average of numbers entered.

  A company that market is publishing both book and audio cass

A company that market is publishing both book and audiocassette versions

  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.

  Perform operations on arrays

Perform operations on arrays execute tests and repetitions

  File containing a series of integers is named

Assume that a file containing a series of integers is named numbers.dat and exists on the computer's disk. Design a java program that reads all the numbers stored in the file and calculates and displays on the console

  Write a program for find greatest common divisor

Write code for a recursive implementation of Euclid's algorithm

  By a minimal interpretation that makes a formula

By a minimal interpretation that makes a formula true, we mean that if one atom is removed from the interpretation then the resulting interpretation does no longer make the formula true.

  Input parameters, and returns nothing

Write a function called ten2one(), that takes no input parameters, and returns nothing (void). The body of the function must include a loop that counts from 10 down to 1, printing the count value each time in the loop. The output should look like (no..

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  You have just upgraded your system

You have just upgraded your system to a "fast and wide" SCSI interface. This system has a floppy disk, a CD-ROM and five 8-gigabyte fixed disks. What is the device number of the host adapter? Why?

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