Program on bst

Assignment Help Computer Engineering
Reference no: EM133380

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.

Reference no: EM133380

Questions Cloud

Plan and implement a stringed musical instrument class : Plan and implement a stringed musical instrument class
How to create an encryption absolutely unbreakable : How to create an encryption absolutely unbreakable
What is the increase or decrease in liabilities : What is the increase or decrease in liabilities of Hodges as of October 31, 2013?
Use jsp to prepare an amortization table for a loan : Use JSP to prepare an amortization table for a loan
Program on bst : Program on BST
What are the main ethical issues of marketing : What are the main ethical issues of marketing Identify and explain the various steps in the marketing research process
Evaluate the economic order quantity for glass : Determine total annual cost of ordering and carrying the glass. Evaluate the Economic Order Quantity for glass.
Law and legal methods : mechanisms of ADR, judicial review, subsidiary legislation, valid contract, types of contract, Judicial Review Action
Evaluate the brocks individual tax return : Evaluate the Brock's individual tax return

Reviews

Write a Review

Computer Engineering Questions & Answers

  Examine how computer forensics investigations pertain to law

Examine how computer forensics investigations pertain to law

  Can you suggest process for choosing appropriate data-mining

Consider on how you would know if a computer were thinking like a human.

  Create an employee class with enough numbers

Create an Employee class with enough numbers.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  How to create the clients by service rep report

How to create the clients by service rep report create mailing label for client table

  How to use ms access and create a database

How to use MS Access and create a database

  Accessing and reading a mouse

Accessing and reading a mouse

  Identify and classify the it infrastructure components

Identify core and side business activities of UPS and explain how same are driven by technology, Identify and classify the IT infrastructure components available at UPS and its subsidiaries

  Write down program that models an employee

Write down program that models an employee

  Describe software construction

Describe software construction

  Illustrate general network design

Illustrate general network design

  What is mno

What is MNO.

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