Write recursive versions of TREE-MINIMUM and TREE-MAXIMUM.
Recursive version of TREE-MINIMUM:
TREE-MINIMUM-RECURSIVE(x) if x.left == NIL return x return TREE-MINIMUM-RECURSIVE(x.left)
Recursive version of TREE-MAXIMUM:
TREE-MAXIMUM-RECURSIVE(x) if x.right == NIL return x return TREE-MAXIMUM-RECURSIVE(x.right)
No comments:
Post a Comment