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

  Describe a project that increase an intranet

Describe a project that increase an Intranet.

  Discuss and describe the potential security threats

Discuss and describe the potential security threats

  Analyze running time of algorithm

Analyze running time of algorithm

  How to illustrate a memory map for a system

Illustrate a memory map for a system with a memory capability of 512MB. Each memory location in system is 8 bits.

  Write c program ''myls'' that functions like unix command ''ls''

Write C program 'myls' that functions like unix command 'ls'.

  How to generate a complete erd in crows foot notation

How to generate a complete ERD in Crow's Foot notation

  Detail advantages of looping

Detail advantages of looping

  Write a program based on encryption scheme

Write a program based on encryption scheme.

  Findout which statement provide required output

Findout which statement provide required output

  Program that displays information about a family member

Program that displays information about a family member

  Why didn''t the vendor just bid fewer disks

Why didn't the vendor just bid fewer disks

  Generate a context diagram of the system

Generate a context diagram of the system

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