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.:- M9719046

Have any Question?


Related Questions in Computer Engineering

What is the broadcast domain and ports for hubs and

What is the Broadcast Domain and Ports for hubs and bridges?

Help me define corporate social responsibilityhelp me

Help me define corporate social responsibility. Help me conduct research on a Fortune 500 company and how do you determine just how (or if) the company ranks from a CSR perspective. Help me understand if the findings cha ...

What are the characteristics of perfect competition and

What are the characteristics of perfect competition, and does is exist in the real world?

Naomi always eats bagels with 1 ounce of cream cheese each

Naomi always eats bagels with 1 ounce of cream cheese. Each bagel eaten in this way provide 15 units of utility. Excess cream cheese or excess bagels do not add to Naomi's utility. Explain the nature of Naomi's utility f ...

The contents of a particular bottle of shampoo marked as

The contents of a particular bottle of shampoo marked as 150 ml are found to be 153 ml at an average, with a standard deviation of 2.5 ml. What proportion of shampoo bottles contain less than the marked quantity? Assume ...

What are information silos what are the problems caused by

What are information silos? What are the problems caused by information silos? How organizations can solve the problems caused by information silos?

Once considered pure science fiction artificial

Once considered pure science fiction, artificial intelligence (AI) is being relied on more and more in today's world. Artificial intelligence deals with algorithms based on complex data sets. If you had to tell story rep ...

Question take screenshots of functions running in clisp

Question : Take screenshots of functions running in cLISP. Provide a description for each screenshot. 1. Create the function DecTree that will implement decision tree. Your function should accept input of decimal string ...

In fostering understanding of utilizing big-oh notation in

In fostering understanding of utilizing Big-Oh notation in an application, please provide a simple java code segment that illustrates how Big-Oh can be utilized to pinpoint performance problems.

Suppose alice shares a secret block cipher key kab with bob

Suppose Alice shares a secret block cipher key, K_AB with Bob, and a different secret block cipher key, K_AC with Charlie. Describe a method for Alice to encrypt an m-block message such that it can only be decrypted with ...

  • 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