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

Create a class for a binary search tree named BST with Netbeans. Each node in th

ID: 3771506 • Letter: C

Question

Create a class for a binary search tree named BST with Netbeans. Each node in the tree should have data, a reference to the node’s left sub-tree, and a reference to the node’s right sub-tree. For the purposes of this project, the nodes can be integers.

The node class of objects can be an inner class of the BST class.

The BST should have a height property, a size property, which is the number of nodes in the tree, and the following methods:

a null constructor

a constructor that builds a tree from a specified array of integers

insert (add a node to the tree)

delete (remove a specific node from the tree)

note: remember to update the height and size properties with insert and delete methods.

search (given a key value, find the node)

preorder iterate ( list all nodes in order according to the preorder traversal of the tree)

inorder iterate ( list all nodes in order according to the inorder traversal of the tree)

postorder iterate ( list all nodes in order according to the postorder traversal of the tree)

value order iterate ( list all nodes in order according to key value of each node)

return the maximum value in the tree

return the minimum value in the tree

find the depth of any given node

Test each method to ensure that it works properly.

Generate a binary search with 100 elements added in the correct order – add the numbers 1 through 100 to the tree in the correct order   add 1, then add 2, then add 3, etc.

What is the height of the resulting tree?

Generate a binary search with 100 elements added in reverse order– add the numbers 100, then 99, then 98, and so on.

What is the height of the resulting tree?

Generate a binary search with 100 randomly generated elements

What is the height of the resulting tree?

Generate a binary search tree with 1,000 randomly generated integers, then find the height of the tree. Repeat this process 100 times and find the approximate relationship between the height of the tree and the size of the tree for the trees randomly generated by your algorithm.

Explanation / Answer

program:   

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