Exercise 12.2-2

Write the recursive versions of TREE-MINIMUM and TREE-MAXIMUM.

TREE-MIN-RECURSIVE(x)

1 if x.left ≠ NIL:

2     return TREE-MIN-RECURSIVE(x.left)

3 else:

4     return x

TREE-MAX-RECURSIVE(x)

1 if x.right ≠ NIL:

2     return TREE-MAX-RECURSIVE(x.right)

3 else:

4     return x