Question: Overview You will write a Java application to build and search a B-Tree. This will include: Node, RootNode, LeafNode classes, and a main class You

Overview

You will write a Java application to build and search a B-Tree. This will include: Node, RootNode, LeafNode classes, and a main class

You will need to make test cases for your tree. You can build the tree in your main class by calling the constructors, which are

LeafNode(Collection values)

RootNode(int min, int max, Collection nodes)

Data Structures

You will need to build a Node object to be the base class for the following two node types:

RootNode - holds a start of the range, end of the range and some number of Nodes (can be RootNodes or LeafNodes).

LeafNode - holds any number of integer values.

There should be a single RootNode that is the "top" of the tree. Its range should encompass the range of the whole tree.

Searching

If the current node is a RootNode and the number that we are looking for is between the start and end of the range, follow the nodes that are descendents of this RootNode. If the current node is a LeafNode, check each value of the leaf node to see if it matches the value that we are searching for.

Rules:

1) No iterators, loops or Java functions that iterate for you. All iteration must happen by recursion.

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!