Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview You will write a Java application to build and search a B-Tree. This will include: Node, RegtNode LeafNode classes, plus a main class of
Overview You will write a Java application to build and search a B-Tree. This will include: Node, RegtNode LeafNode classes, plus a main class of some sort You will need to make test cases for your tree. You can build the tree in your main class by calling the constructors. The graders will create their own tree(s) by modifying your code and test those. 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 LeatNodes). 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. 2) No global or static variables. The class that does the searching should not have any members. 3) Please make constructors: LeatNode(Collection int> values) RootNode(int min, int max, Collection nodes) Remember to work independently. This is not a large lines of code) assignment. It is an assignment that is designed to make you think in a different way. MAKE SURE TO TEST YOUR CODE! Make a B-Tree and search for numbers that are in it and numbers that are not in it. Note - this is not quite a typical B-Tree; the assignment is a slightly simplified version of an actual B- Tree. Example B-Tree diagram: RootNode: 1 1000 RootNode: 100 199 RootNode: 200399 LeafNode: 100, 120, 140, 160 LeafNode: 200, 220, 240, 260 RootNode: 300399 LeafNode: 300, 320, 340, 360 Overview You will write a Java application to build and search a B-Tree. This will include: Node, RegtNode LeafNode classes, plus a main class of some sort You will need to make test cases for your tree. You can build the tree in your main class by calling the constructors. The graders will create their own tree(s) by modifying your code and test those. 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 LeatNodes). 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. 2) No global or static variables. The class that does the searching should not have any members. 3) Please make constructors: LeatNode(Collection int> values) RootNode(int min, int max, Collection nodes) Remember to work independently. This is not a large lines of code) assignment. It is an assignment that is designed to make you think in a different way. MAKE SURE TO TEST YOUR CODE! Make a B-Tree and search for numbers that are in it and numbers that are not in it. Note - this is not quite a typical B-Tree; the assignment is a slightly simplified version of an actual B- Tree. Example B-Tree diagram: RootNode: 1 1000 RootNode: 100 199 RootNode: 200399 LeafNode: 100, 120, 140, 160 LeafNode: 200, 220, 240, 260 RootNode: 300399 LeafNode: 300, 320, 340, 360
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started