Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include BST.h using namespace std; /**************************************************************** * CONSTRUCTOR * Creates an empty binary tree ****************************************************************/ BST::BST() { } /**************************************************************** * DESTRUCTOR * Free

image text in transcribed

#include #include #include "BST.h"

using namespace std;

/**************************************************************** * CONSTRUCTOR * Creates an empty binary tree ****************************************************************/ BST::BST() { }

/**************************************************************** * DESTRUCTOR * Free all memory used by current tree ****************************************************************/ BST::~BST() { // Write code to remove and deallocate all nodes in the tree }

void BST::Insert(int toInsert) { // Write your code here }

void BST::Delete(int toDelete) { // Write your code here }

void BST::Transplant(Node *u, Node *v) { // Write your code here }

Node *BST::Successor(Node *x) { // Write your code here }

Node *BST::Minimum(Node *x) { // Write your code here }

Node *BST::Maximum(Node *x) { // Write your code here }

Node *BST::Search(int toFind) { // Write your code here }

void BST::Print(TraversalOrder Order) { if(Order==InOrderTrav) InOrder(root); else if(Order==PreOrderTrav) PreOrder(root); else if(Order==PostOrderTrav) PostOrder(root); }

void BST::PreOrder(Node *x) { // Write your code here }

void BST::InOrder(Node *x) { // Write your code here }

void BST::PostOrder(Node *x) { // Write your code here }

Binary Search Trees Description In this lab your goal is to implement standard operations on binary search trees, including insert and delete. See section 12.3 in the textbook. A sample class structure, with empty methods, is given in the support code. You can either use the given class structure or create your own. In this assignment the keys are integers. You will use Grade04 to test your code. Your execution file name must be "BST.exe". Refer to the previous lab assignments for instructions on how to use the grading tool. The input contains one of the following commands on a line: . i key: Insert key into the BST. For example, "i 2" means Insert key 2 into the BST. . d key: Delete key from the BST. For example, "d 2" means "Delete key 2 from the BST". Do nothing if the BST does not contain the key. .pre: Outpu all keys in preorder. post: Output all keys in postorder in: Output all keys in inorder. e: Finish your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

What factors change the energy expended for a given job?

Answered: 1 week ago

Question

4. What are the main factors responsible for high costs today?

Answered: 1 week ago

Question

What does the start( ) method defined by Thread do?

Answered: 1 week ago