Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void add(T item)
- {
- if(item.compareTo(data)<0)
- {
- if(leftChild==null)
- {
- leftChild= new BinaryTreeNode(item);
- }
- else
- leftChild.add(item);
- }
- else
- {
- if(rightChild==null)
- rightChild=new BinaryTreeNode(item);
- else
- rightChild.add(item);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement