Exercise 3.26: Write API for binary trees