Skip to content

Commit f9a0b4c

Browse files
author
robert
committed
add remove method
1 parent f9b2ee8 commit f9a0b4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/com/algorithm/tree/AVLTree.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,15 @@ protected BinaryTreeNode<T> doubleWithRightChild(BinaryTreeNode<T> k3) {
9898
k3.right = roateWithLeftChild(k3.right);
9999
return roateWithRightChild(k3);
100100
}
101+
102+
@Override
103+
public void remove(T x) {
104+
BinaryTreeNode<T> node = findNode(root, x);
105+
if (node == null || node.hintcount < 0) {
106+
return;
107+
} else {
108+
lazyRemove(node);
109+
}
110+
}
111+
101112
}

0 commit comments

Comments
 (0)