Java program to create a tree
Course:- JAVA Programming
Reference No.:- EM13463

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
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

Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Discuss factors that affect sorting in sediment. How could one tell the latitude at which a sediment was originally deposited? Compare and contrast phosphate and manganese nod
In this project, you will simulate some people catching fish in a lake. The purpose of the assignment is to get used to using Arrays as well as getting more experience in havi
Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at l
Create an Android app that will be used to enter student grades for college courses. Develop three screens as follows: The first screen should allow the entry of a student id,
Write a program that implements a two digit decimal seconds counter using two 7-segment displays.  Make this program using java programming. Make this program in simple way.
Need to create a simple Java program that determines cost of insurance by including any additional person based on age (thus questions regarding age and how many people appl
Write a client class to test your implementation of the Vector3D class thatyou implemented. Name the package in which this class is defined (projectname) vector3dapp.
Cloud computing is one of the biggest catchphrases in the Information Technology world. Virtualization is the core technology behind cloud resource sharing. The deployment s