Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question

Programming Assignment on BST

This program requires you to apply a Binary Search Tree with the following operations to be executed on the tree -

1) Insert a node in the tree

2) Delete a node from the tree

3) Search for an element in the tree

4) Traverse the tree in Preorder, Inorder and Postorder fashion

5) Print the contents of the tree in preorder fashion

The program shall comprise of the following files:
TreeNode.h
BST.h
BST.cpp
Driver.cpp

The file TreeNode.h shall consist of the class TreeNode. This class shall have BST as its friend class. In addition, this file should also contain the description of the class constructor and accessor functions (thus we avoid creating a TreeNode.cpp) The outline of this file is as follows:

Class TreeNode {
Friend class BST;
Public:
TreeNode(); //default constructor
TreeNode(int i, TreeNode* L = 0; TreeNode* R = 0); //explicit value constructor
int getItem () const; // accessor function

private:
int item;
TreeNode *Lchild;
TreeNode *Rchild;

};

TreeNode::TreeNode()
{
Lchild = Rchild = NULL;
}

TreeNode::TreeNode(int i, TreeNode *L = 0, TreeNode *R = 0) : item(i), Lchild(L), Rchild(R)
{}

int TreeNode::getItem() const
{ return item;}

The file BST.h shall contain the class declaration of class BST. In addition to the public member functions, have 4 utility functions which will help you to perform the search, preorder, postorder and inorder traversal operations. The file BST.cpp shall contain the public function descriptions that were declared in file BST.h.

The file driver.cpp should test all functionalities that you have incorporated for the BST.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9133794

Have any Question?


Related Questions in Computer Engineering

Suppose you want to back up a huge file to a cd-r you can

Suppose you want to back up a huge file to a CD-R. You can do this by splitting the file into smaller pieces and backup up those pieces separately. Write a utility program named FileSplitter that splits a large file into ...

Given the following scenarios what is the standard

Given the following scenarios, what is the standard deviation for Acme, Inc.? Economy / Pri / Ri Strong / 0.3 / 40% Normal / 0.4 / 16% Weak / 0.3 / -20% Express your answer in decimal format (e.g., 0.1935 to represent 19 ...

Given the following three months of data what is the

Given the following three months of data what is the coefficient of variation? t, R_t 1, 21.01% 2, -13.83% 3, 15.67% 4, 0.88% 5, -1.32% Express your answer in total return decimal format.

Taylor found that 8 of the recipients of loans form a

Taylor found that 8% of the recipients of loans form a particular mortgage lender default within 3 years. If he takes a random sample of 736 customers who received loans 3 years ago, what is the average number of custome ...

A 200g sample of acetylsalicylic acid better known

A 2.00g sample of acetylsalicylic acid, better known asaspirin, is dissolved in 100mL of water and titrated with 0.200mol/L NaOH(aq) to the end point. The volume of base required is 55.5mL. Calculate the molar mass of ac ...

Question discuss in 500 words how you would advise your

Question: Discuss, in 500 words, how you would advise your current employer to use encryption to reduce the vulnerabilities of their data at rest, in use, and in transit (or in motion). Identify at what points you think ...

During a year of operation a firm collects 650000 in

During a year of operation, a firm collects $650000 in revenue and spends $250000 on labor expense, raw materials, rent, and utilities. The firm's owner has provided $350000 of her own money instead of investing the mone ...

Explain that when an unauthorized individual gains access

Explain that when an unauthorized individual gains access to the information an organization trying to protect, that act is categorized as a deliberate act of espionage or trespass.

Submit a proposal of your ideal computer-in narrative form

Submit a proposal of your "ideal" computer-in narrative form. Make sure to answer the following questions: • State the technical specifications of your ideal computer • What would you like your ideal computer to accompli ...

Tablet recommendationpreparation imagine the following

Tablet Recommendation: Preparation Imagine the following scenario: A hospital has hired you as a consultant to recommend a tablet for their employees to use, with these parameters: The hospital provides wifi access to th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As