HOMEWORK 8. Deadline: Monday, January 7 ======================================= 1. Write three binary predicates pre_order, in_order, and post_order that for a given binary tree return a list that corresponds respectively preorder, inorder, and postorder traversal of the tree. To traverse a non-empty binary tree in preorder, perform the following operations: 1. Visit the root. 2. Traverse the left subtree in preorder. 3. Traverse the right subtree in preorder. To traverse a non-empty binary tree in inorder, perform the following operations: 1. Traverse the left subtree in inorder. 2. Visit the root. 3. Traverse the right subtree in inorder. To traverse a non-empty binary tree in postorder, perform the following operations: 1. Traverse the left subtree in postorder. 2. Traverse the right subtree in postorder. 3. Visit the root. 2. Solve the following puzzle (from Edi Weitz). Three mice are living next to each other in three holes in the wall. Each mouse has a favorite cheese flavor and a favorite TV show. Here are the hints: 1. Mice: Mickey, Mighty and Minny. 2. Cheese: Gouda, Emmentaler, Brie. 3. Shows: Emergency Room, Seinfeld, Simpsons. 4. Mickey Mouse loves Gouda. 5. Mighty Mouse's favorite TV show is Emergency Room. 6. The mouse that lives in the left hole never misses an episode of Seinfeld. 7. Mickey Mouse and Mighty Mouse have one mouse hole between them. 8. The Simpsons fan does not live on the left of the Brie lover. For each mouse find the hole where it leaves, a favorite cheese and a favorite show.