Chapter 3 exercises and tests for tree functions