Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MA/CSSE 473 – Design and Analysis of Algorithms Name:_____Solution________ Score:____/ 10 In-class Quiz Day 05 circle your Section # 01(3rd) 02 (4th) 1. What do we mean by a deficient rectangular grid? It is missing one of its squares. 2. An Extended Binary Tree T with n internal nodes has __n+1__ external nodes. 3. Prove the statement from the previous question using (strong) induction, based on the definition of EBT. Strong induction on the number of internal nodes in T. Let IN(T) be the # of internal nodes in the EBT T, and let EN(T) be the number of external nodes. Base case. IN(T) = 0. This is the base case in the definition of EBT, and there is one external node. Induction step. IN(T) > 0, so T has a root (internal node), and two subtrees TL and TR. Notice that IN(T) + IN(TL) + IN(TR) + 1, and EN(T) = EN(TL) + EN(TR). Induction assumption. The property is true for any EBT with fewer nodes than T. In particular, for TL and TR, which are smaller because they do not include T’s root. We need to use this to show that it is true for T. EN(T) = EN(TL) + EN(TR) = IN(TL) + 1 + IN(TR) + 1 [by the induction assumption] = (IN(TL) + IN(TR) + 1) + 1 [rearrange and group the terms] = IN(T) + 1 4. If c is a positive constant, find a simple big-Theta expression (as a function of n) for the following sum when 0 < c < 1 The infinite series converges to 1/(1-c), so (1) when c = 1 f(n) = n, so it is (n) when c > 1 f(n) = (c^(n+1) – 1) / (c – 1). The limit of f(n) divided by c^n as n is c/(c-1), so f(n) is (c^n). 5. Which is harder (computationally): factoring numbers or determining whether numbers are prime? factoring is harder 6. Trace the integer division algorithm from class for divide(19, 4) . divide(19, 4): q, r = divide(9, 4) q, r = divide (4, 4) q, r = divide(2, 4) q, r = divide(1, 4) q, r = divide(0, 4) = 0, 0 x is odd, so r=1 return 0, 1 q, r, = 0, 2 return 0, 2 q, r = 0, 4 q, r = 1, 0 return 1, 0 q, r, = 2, 0 x is odd, so q, r = 2, 1 return 2, 1 q, r = 4, 2 x is odd, so q, r, = 4, 3 return 4, 3 7. Tell me about anything from today’s lecture that you found confusing or feel that we need to spend more time on. Be as specific as you can, (or write N/A). Credit as long as they write something 8. What questions do you have (from today’s lecture, from the reading, or form the course in general), or write N/A. Credit as long as they write something 9.