Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment you are to modify your C++ BST class and add the following f

ID: 3786907 • Letter: F

Question

For this assignment you are to modify your C++ BST class and add the following functionality

Task

For this assignment you are to modify your C++ BST class and add the following functionality

-          Remove

-          Tree Height

-          FindMin

-          FindMax

Your program will take in a command file called “cmd.txt” which will instruct your program on what operations to run

File Format

<command> <0 or 1 arguments>

Commands

-          1              insert

-          2              in order

-          3              post order

-          4              pre order

-          5              search

-          6              delete

-          7              findHeight

-          8              findMin

-          9              findMax

Example File

1 20

7

1 30

7

1 10

7

1 25

7

1 29

7

1 23

7

1 56

7

1 89

7

1 4

7

1 33

7

2

3

4

6 20

2

3

4

6 89

2

3

4

8

9

Expectations

You should not use any already implemented code such as a library for your linked list

Your code should be well formatted with proper spacing and proper naming

Your code should have well named variables. No a’s b’s or c’s as names unless it is for something like a loop counter

Your code must have the same output formatting you see below

Height of tree: 3 Inserting: 29 Height of tree : 4 Inserting: 23 Height of tree: 4 Inserting: 56 Height of tree : 4 Inserting: 89 Height of tree : 4 Inserting: 4 Height of tree : 4 Inserting: 33 Height of tree : 4 Inorder: 4 10 20 23 25 29 30 33 56 89 Inorder: 4 10 23 25 29 30 33 56 Preorder: 23 10 4 30 25 29 56 33 Min val: Max val: 56 29 80 33 29 639 8 56 80 56 33 23 356 36 3 39 56 50 89 56 36 023 53 5 33 39 36 33 89 59 920 20 2 25 33 33 25 35 35 529 29 2 29 25 25 20 20 20 35 35 23 29 29 24 24 24 44444420 20 20 10 10 10 .............. 0 10 10 1 e9e3e6e9e e3e r2r2r5r8r4r3r4 24 24 2 : 45 fgf gf gf gf gf gf r .. r .. r .. ococococococo.. er .. er .. er .. .. rderderde11 ttt,t t t t t t t t t t e r d e r d e r d a a hrhrhrhrhrhrhdordordorvv gege issssisisioseoseosenx enenenenenenenornornoria HIH-HIH-HIH-HIPPIPPIPPMM

Explanation / Answer

# include <iostream.h>
# include <conio.h>
# include <stdlib.h>
class binarysearch
{
int a[100],n;
public:
void accept()
{
cout<<"ENTER N VALUE ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"ENTER "<<i<<" Value ";
cin>>a[i];
}
}
void print()
{
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
}
void sort()
{
int i,j,tmp,limit;
limit=n-1;
for(i=0;i<n-1;i++)
for(j=0;j<limit-i;j++)
if(a[j+1]<a[j])
{
tmp=a[j+1];
a[j+1]=a[j];
a[j]=tmp;
}
}
void search()
{
int num,low,high,mid;
cout<<"ENTER A NUMBER TO SEARCH ";
cin>>num;
low=0;
high=n-1;
while(low<=high)
{
mid=(low+high)/2;
if(num==a[mid])
{
   cout<<"THE NUMBER FOUND AT "<<mid<<" LOCATION";
   getch();
   exit(0);
}
else if(num<a[mid]) high=mid-1;
else if(num>a[mid]) low=mid+1;
}
cout<<"THE NUMBER NOT FOUND ";
}
};
void main()
{
clrscr();
binarysearch s;
s.accept();
s.sort();
s.print();
s.search();
getch();
}

searching program

# include <iostream.h>
# include <conio.h>
# include <stdlib.h>
class searching
{
int a[100],n;
public:
void accept()
{
cout<<"ENTER N VALUE ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"ENTER "<<i<<" Value ";
cin>>a[i];
}
}
void print()
{
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
}
void search()
{
int num;
cout<<"ENTER A NUMBER TO FIND ";
cin>>num;
for(int i=0;i<n;i++)
if(a[i]==num)
{
cout<<"The number found at "<<i<<" Location";
getch();
exit(0);
}
cout<<"The number not foud ";
}
};
void main()
{
clrscr();
searching s;
s.accept();
s.print();
s.search();
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote