Should contain an int indexofint value method returns the


Create an abridged binary tree that contains a bNode class that describes a single node of a binary tree, and a bTree class that uses bNode object to define the object binary tree with all of its features.

Project requirements: Your program should contain two objects with the following criteria: An object named bNode that describes a single node in the binary tree. The bNode object should contain a default constructor.

The bNode object should contain an alternate constructor that initializes the objects content variable. All instance variables should be private. Should make proper use of getters and setters.

An object named bTree that utilizes bNode object in order to define a binary tree. Should contain a default constructor. Should contain an alternate constructor bTree(int[] anArray) that allows the user to create a bTree from an array in a depth-first fashion. Should contain an void add(int value, int depth, int number) method that inserts a node to the position depth, number with a value of value. If that path of the tree is not populated (a degenerate tree), then the node should be inserted as the first valid item in the path to the selected node. Should contain an int remove(int depth, int number) method If the node does not exist, then do nothing and return a value of -1 (this is not meaningful, but for now should suffice). Should contain boolean contains(int value) method. Should contain an int get(int depth, int number) method. If node does not exist, then return -

1. Should contain an int indexOf(int value) method Returns the index (node number) of the first occurrence of value Should contain a void print(String traversal) method that prints all elements of the bTree based on the traversal method in one row delimited by one space.

The argumenttraversal may be one of the following three: preorder, inorder, or postorder.

Request for Solution File

Ask an Expert for Answer!!
Essay Writing: Should contain an int indexofint value method returns the
Reference No:- TGS0828934

Expected delivery within 24 Hours