Question: I would appreciate if it was in Java, and it consists of 2 questions. Q1 -50 pts) A binary tree is a complete binary tree

 I would appreciate if it was in Java, and it consists

I would appreciate if it was in Java, and it consists of 2 questions.

Q1 -50 pts) A binary tree is a complete binary tree if all the internal nodes (including the root node) hav exactly two child nodes and all the leaf nodes are at level 'h' corresponding to the height of the tree Consider the code for the binary tree given to you for this question. Add code in the blank space provided for the member function checkCompleteBinaryTree() in the BinaryTree class. This member function should check whether the binary tree input by the user (in the form of the edge information stored in a file) is a complete binary tree. To test your code, come up with two binary trees of at least 12 vertices: one, a complete binary tree and another, a binary tree that is not a complete tree Prepare the input file for the two binary trees and input them to the code for this question. Capture the screenshots of the outputs. Q2 - 50 pts) A binary search tree (BST) is a binary tree in which the data for an internal node is greater than or equal to the data of its left child node and lower than or equal to the data of its right child node Consider the code for the binary tree given to you for this question. Add code in the blank space provided for the member function checkBST) in the BinaryTree class. This member function should check whether the binary tree input by the user (in the form of the edge and data information stored in two separate files) is a binary search tree You are provided a sample of two files that constitute the edges and data for a binary tree that is also a binary search tree. You could validate your code with these two files. The main function of the code given to you is already updated to input the above two files. Your task is only to implement the checkBSTO function and test its working through files that represent the edges and data for a binary tree To test your code, come up with two binary tree of at least 12 nodes as follows: (i) A binary tree that is also a BST with the data of the nodes setup in such a way that the data for an internal node is greater than or equal to its left child and lower than or equal to its right child (ii) In the binary tree that you came up with for (i), change the data of the nodes in such a way that for at least one internal node, the BST requirement is violated so that the binary tree is not a BST Prepare the input files (edges and data files) for the two scenarios above and test your code with these file e to search Ok

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!