1. Briefly state the Master Theorem.What type of problem is it useful for? 2. What is the balance condition of the AVL tree? Does this balance condition mean that the depth of the highest and lowest leaves in the tree will be different by at most one? 3. Under what conditions does a BFS algorithm on Graphs work as a single source shortest path algorithm? Solution 1) Master Theorem : A recurrence relation of the following form: T(n) = c n < c1 = aT(n/b) + (n i ), n c1 Has as its solution: 1) If a > bi then T(n) = (n logb a ) (Work is increasing as we go down the tree, so this is the number of leaves in the recursion tree). 2) If a = b i then T(n) = (n i logb n) (Work is the same at each level of the tree, so the work is the height,logb n, times work/level). 3) If a < bi then T(n) = (n i ) (Work is going down as we go down the tree, so dominated by the initial work at the root). The Master method is a general method for solving (getting a closed form solution to) recurrence relations that arise frequently in divide and conquer algorithms, which have the following form: T(n) = aT(n/b) + f(n) where a 1, b > 1 are constants, and f(n) is function of non-negative integer n. There are three cases. (a) If f(n) = O(n logb a ), for some > 0, then T(n) = (n logba ). (b) If f(n) = (n logb a ), then T(n) = (n logb a log n). (c) If f(n) = (n logb a+ ) for some > 0, and af(n/b) cf(n), for some c < 1 and for all n greater than some value n 0, Then T(n) = (f(n)). 2) An AVL tree has a balance condition such that each node stores the maximum depth of nodes below it. A NULL tree has a level of -1 and a leaf node has a level of 0. A node having 1 or 2 subtrees will have as its own level the maximum of left or right subtree levels +1. Within an AVL tree, the maximum difference allowed between left and right subtree levels is 1. When an insertion or deletion operation results in this difference increasing to 2, rearrangements called rotations are performed to reduce the imbalance for an AVL tree to retain the AVL balance condition. True. A heap is derived from an array and new levels to a heap are only added once the leaf level is already full. As a result, a heap’s leaves are only found in the bottom two levels of the heap and thus the maximum difference between any two leaves’ depths is 1. A common mistake was pointing out that a heap could be arbitrarily shaped as long as the heap property (parent greater than its children in the case of a maxheap) was maintained. This heap is not a valid heap, as there would be gaps if we tried to express it in array form, heap operations would no longer have O(log n) running time, and heap sort would fail when using this heap. Another common mistake was simply justifying this statement by saying a heap is balanced. An AVL tree is also balanced, but it does not have the property that any two leaves have depths that differ by at most 1. 3) BFS can only be used to find shortest path in a graph if: There are no loops All edges have.