+1-415-670-9189
info@expertsmind.com
Java program to create a tree
Course:- JAVA Programming
Reference No.:- EM13463




Assignment Help
Assignment Help >> JAVA Programming
You will need a BottomUpTwoThreeFourTree class, with a BottomUpTwoThreeTreeFourTree constructor which takes no parameters.
BottomUpTwoThreeTreeFourTree will need an insert(int x) method, which will insert the value x into your tree. For this tree, duplicate insertions should be discarded. That is, if I insert a value into the tree which is already in the tree, do not change your tree. As discussed in class, if a node needs to split, the value passed up to the parent should be the median value of the three keys in the node, before the 4th key is added.
BottomUpTwoThreeFourTree will need a search(int x) method, which will search for the value x in your tree. The method should return a String, formatted as follows. If the value x is in the tree, it will reside in a node with either one, two, or three keys. For a one key node, the string will just be that node's key as a String. If it is a two key node, the string should be the two values, in increasing order, with a single space between them. Finally, three keys should be returned with a single space between each pair, in increasing order. Example: if we are searching for the number 17, and it is a key alone in a node, the search function should return "17". If it is in a node with 35, you should return "17 35". If it is in a node with 10, you should return "10 17". And, if it in a node with keys 10 and 35, you should return "10 17 35". Note, there is no space after the last key value.
If the value searched for is not in the tree, your search should have terminated at a leaf node. In that case, print the contents of that leaf node, with the same formatting described above. That is, if 17 is not in the tree, and you end in a node that contains keys 18 and 20, return "18 20".
You need to submit your own JUnit tests as well, again in a file with a name ending in Test.java or Tests.java. Your main grade will be based on (a) how well your tests cover your own code, (b) how well your code does on your tests, and (c) how well your code does on MY tests. If you fail even one of my tests, I will set up my tests to make sure that you fail many of them. If you know that your code has an error, it is hard to consider your code as "working"



Put your comment
 
Minimize


Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Calculates and displays the cost of computing infrastructure setup - The application should ask the user to enter the number of computers for each bank (total N banks) and cal
Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of cr
Write a Java program that Revise the MeanMedian class so that the user can enter any number of values up to 20. If the list has an even number of values, median is the numer
Please consider the features of Java classes, and then define a Java class for a DNA sequence object to include instance variable names and methods that you can use to defin
a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can u
Create an application that generates a quiz. Prompt for the user's first and last name, college major, and confidence in test taking (high, medium, or low). The quiz should co
Write a CarbonFootPrint with only a pure virtual getCarbonFootprint method -  Have each of your classes inherit from the abstract class and implement the getCarbonFootprint m
CPS 350- Write a program to implement autocomplete for a given set of N terms, where a term is a query string and an associated nonnegative weight. That is, given a prefix,