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 TwoThreeTreeT item
root new TreeNodeitem;
inserted false;
public void insertT insertKey
root insertItemroot insertKey;
inserted false;
public void retrieveT searchKey
TreeNode treeNode retrieveItemroot searchKey;
if treeNode null
System.out.printlnsearchKey is not present in tree.";
else
System.out.printlnsearchKey is present in tree.";
public void removeT deleteKey
root removeItemroot deleteKey;
private TreeNode insertItemTreeNode treeNode, T insertKeycomplete this implementation
private TreeNode insertItemTreeNode treeNode, T insertKey
Implement insertItem here.
private TreeNode removeItemTreeNode treeNode, T deleteKey
Implement removeItem here
The error will go away once you implement and returns an item
private void splitTreeNode treeNode, T item
public void setPreorder
preorderroot;
public void setInorder
inorderroot;
public void setPostorder
postorderroot;
private void preorderTreeNode treeNode
implement preorder here
if treeNode null
return;
private void inorderTreeNode treeNode
implement inorder here
private void postorderTreeNode 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
noarg constructor
this.small null;
this.large null;
this.leftChild null;
this.rightChild null;
this.middleChild null;
this.parent null;
this.temp null;
public TreeNodeT 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 TreeNodeT 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 TreeNodeT 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 setSmallItemT small
this.small small;
public T getLargeItem
return large;
public void setLargeItemT large
this.large large;
public TreeNode getLeftChild
return leftChild;
public void setLeftChildTreeNode leftChild
this.leftChild leftChild;
public TreeNode getRightChild
return rightChild;
public void setRightChildTreeNode rightChild
this.rightChild rightChild;
public TreeNode getMidChild
return middleChild;
public void setMidChildTreeNode middleChild
this.middleChild middleChild;
public TreeNode getParentNode
return parent;
public void setParentNodeTreeNode parent
this.parent parent;
public TreeNode getTempChild
return temp;
public void setTempChildTreeNode temp
this.temp temp;
end TreeNode
import java.util.Scanner;
public class DriverTwoThreeTree
public static void mainString args
Scanner input new ScannerSystemin;
TwoThreeTree tttree new TwoThreeTree;
complete the rest as per the instruction
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
