Question: public class TwoThreeTree > { private TreeNode root; private boolean inserted; public TwoThreeTree ( ) { root = null; inserted = false; } public TwoThreeTree

public class TwoThreeTree>{
private TreeNode root;
private boolean inserted;
public TwoThreeTree(){
root = null;
inserted = false;
}
public TwoThreeTree(T item){
root = new TreeNode(item);
inserted = false;
}
public void insert(T insertKey){
root = insertItem(root, insertKey);
inserted = false;
}
public void retrieve(T searchKey){
TreeNode treeNode = retrieveItem(root, searchKey);
if (treeNode == null){
System.out.println(searchKey +" is not present in 2-3 tree.");
} else {
System.out.println(searchKey +" is present in 2-3 tree.");
}
}
public void remove(T deleteKey){
root = removeItem(root, deleteKey);
}private TreeNode insertItem(TreeNode treeNode, T insertKey){//complete this implementation }
private TreeNode insertItem(TreeNode treeNode, T insertKey){
// Implement insertItem here.
}
private TreeNode removeItem(TreeNode treeNode, T deleteKey){
// Implement removeItem here
// The error will go away once you implement and returns an item
}
private void split(TreeNode treeNode, T item){...}
public void setPreorder(){
preorder(root);
}
public void setInorder(){
inorder(root);
}
public void setPostorder(){
postorder(root);
}
private void preorder(TreeNode treeNode){
// implement preorder here
if (treeNode == null){
return;
}
}
private void inorder(TreeNode treeNode){
// implement inorder here
}
private void postorder(TreeNode treeNode){
// implement postorder here
}
}
public class TreeNode {
private T small;
private T large;
TreeNode leftChild;
TreeNode rightChild;
TreeNode middleChild;
TreeNode parent;
TreeNode temp;
public TreeNode(){
// no-arg constructor
this.small = null;
this.large = null;
this.leftChild = null;
this.rightChild = null;
this.middleChild = null;
this.parent = null;
this.temp = null;
}
public TreeNode(T small){
// Initializes tree node with a small item and no children.
this.small = small;
this.large = null;
this.leftChild = null;
this.rightChild = null;
this.middleChild = null;
this.parent = null;
this.temp = null;
}
public TreeNode(T small, T large){
// Initializes tree node with a small and a large items and no children.
this.small = small;
this.large = large;
this.leftChild = null;
this.rightChild = null;
this.middleChild = null;
this.parent = null;
this.temp = null;
}
public TreeNode(T small, T large, TreeNode leftChild, TreeNode rightChild, TreeNode middleChild,
TreeNode parent, TreeNode temp){
this.small = small;
this.large = large;
this.leftChild = leftChild;
this.rightChild = rightChild;
this.middleChild = middleChild;
this.parent = parent;
this.temp = temp;
}
public T getSmallItem(){
return small;
}
public void setSmallItem(T small){
this.small = small;
}
public T getLargeItem(){
return large;
}
public void setLargeItem(T large){
this.large = large;
}
public TreeNode getLeftChild(){
return leftChild;
}
public void setLeftChild(TreeNode leftChild){
this.leftChild = leftChild;
}
public TreeNode getRightChild(){
return rightChild;
}
public void setRightChild(TreeNode rightChild){
this.rightChild = rightChild;
}
public TreeNode getMidChild(){
return middleChild;
}
public void setMidChild(TreeNode middleChild){
this.middleChild = middleChild;
}
public TreeNode getParentNode(){
return parent;
}
public void setParentNode(TreeNode parent){
this.parent = parent;
}
public TreeNode getTempChild(){
return temp;
}
public void setTempChild(TreeNode temp){
this.temp = temp;
}
}// end TreeNode
import java.util.Scanner;
public class DriverTwoThreeTree {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
TwoThreeTree tttree = new TwoThreeTree();
//complete the rest as per the instruction
}
}
 public class TwoThreeTree>{ private TreeNode root; private boolean inserted; public TwoThreeTree(){

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!