Using the Stack and Queue developed by yourself in part(i) construct the following ADT of Binary Tree.
Fantastic news! We've Found the answer you've been seeking!
Question:
template
class BinaryTree
{
public:
//constructor
BinaryTree ();
//Build the binary tree from the data given in the array.
//If a node doesn't exist the array element is 0
void BuildTree(DT *Arr, int Size);
// post order traversal (iterative)
void PostOrderItr();
// level order traversal (iterative)
void LevelOrder();
// this function returns true if the Binary tree is a Binary Search Tree and
// false otherwise. Please implement it iteratively.
bool isBST();
// this function returns the height of the binary tree.
//Please implement it recursively.
int Height();
//This function returns the number of nodes present at
// level (passed in as a parameter) of the binary tree.
// root is at level 1
int NodesAtLevel(int level);
private:
// you may add any other private members that might be needed by recursive functions
BNode
};
#endif
iii. [Mark 10] Design and construct a main function that demonstrates all the functions you developed in part(ii) above. Build binary trees carrying your roll number using any datatype you like.use roll.no 123456
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date: