Implement The Basic Functions Needed To Build And Search Binary Search Trees
- Country :
Australia
You will have to implement the basic functions needed to build and search binary search trees (abbreviated BST). The binary search tree can be implemented as a link tree or an array tree You can use following header files and CPP code fies. Output file is given in the last page.
namespace arrbst
{
//Functions to call in Main Function
bool isEmpty();
bool find(int value);
void insert(int value);
void remove(int value);
void make Empty;
void printTree():
}
int size:
int Bst;
//Utility methods for array tree data structure
void insert Element(int x);
void search Element(int x);
void in Order ant current index);
void pre Order(int current index);
void post Order(int current Index);
vold parent(int x);
int extend Size(int x);
namespace lbst
{
Functions to call in Main Function
bool is Empty
( bool find(int value)
void insert gint value);
void remove(int value);
void make Empty);
void printTree()
{
Structure Node
int val;
Node" left;
Node" right;
}
Node root
int numNodes;
//Utility methods for linked tree data structure
Node findNode(Node node, int x) ;
Node findMinNode(Node node);
Node findMaxNode(Node node);
Node findSuccessor(Node node);
Node" findParentOf(int x);
Node insentNode(Node node nex);
void removeAlNodes Node node);
void printNodesinOrder(Node node);
void printNodesPreOrder Node node)
void printNodes PostOrder (Node node);
Output Screen
BST can be implemented in a couple of ways Press 1 or 2 to proceed.
- Array Tree
- Link Tree
- Exit Program
If user enters 1 OR 2 then following message should display!
Following basic operations are available in BST Data Structure;
- Insert element in BST
- Find element in BST
- Remove element in BST
- Print BST
- Exit from the menu
(if user press 1 then folowing message should display]
Please enter element to insert in BST: 45
Element added in BST Continue [Y/N) Y
Please enter element to insert in BST :35
Element added in BST Continue (Y/N) N
Following basic operations are available in BST Data Structure;
- Insert element in BST 2
- Find element in BST
- Remove element in BST
- Prim BST
- Exit from the menu
Are you struggling to keep up with the demands of your academic journey? Don't worry, we've got your back! Exam Question Bank is your trusted partner in achieving academic excellence for all kind of technical and non-technical subjects.
Our comprehensive range of academic services is designed to cater to students at every level. Whether you're a high school student, a college undergraduate, or pursuing advanced studies, we have the expertise and resources to support you.
To connect with expert and ask your query click here Exam Question Bank