s******d 发帖数: 61 | 1 careercup果然囧.....还是学校ppt好!
public E successor(E x){
return succAux(root, x, null);
}
private E succAux(Node t, E x, E best){
if(t==null)
return best;
int c=x.compareTo(t.v);
if(c<0)
return succAux(t.l, x, t.v);
else return succAux(t.r, x, best);
}
The last left turn is the successor(X). |
|