Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void rightRight(Node<T> check, Node<T> child, Node<T> parent) {
- boolean right = false, noParent = false;
- check.setRightChild(null);
- child.setParent(null);
- if (parent == null)
- noParent = true;
- else if (parent.getValue().compareTo(check.getValue()) < 0)
- right = true;
- if (!noParent) {
- if (right)
- parent.setRightChild(child);
- else
- parent.setLeftChild(child);
- }
- if (child.hasLeftChild())
- check.setRightChild((Node<T>) child.getLeftChild());
- child.setLeftChild(check);
- check.setParent(child);
- if(check==root) root=child;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement