hw1f03-sol-post - CS373 Fall 2003 - NMG * Solution *post*...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
*********** Solution *****post************ September 5, 2003 Homework Assignment 1 – Problem 9 omitted 9/9/03, prob. 10 fixed* Due Friday 9/12/02 after class Problem set for chapter 1 (total of 100 points): The problems are weighted as shown All steps must be shown. The three basic steps for inductive proofs must be explicitly shown Problem 1 (10 points) Let f be a function on the natural numbers satisfying: f(n) = 0, if n = 0 f(n) = 4f(n/2), if n is even and n > 0 f(n) = f(n-1) +2n-1 if n is odd Using strong induction prove that f(n) = n 2 for all n 0. Hint on strong induction: As before, show the basis step that P(0) is true. We now have a somewhat different inductive assumption: “assume p(0), p(1), . .., p(n) is true” and from this assumption prove that p(n+1) to be true. Note that the inductive assumption is now a sequence of propositions including the basis. Now we can use any of the propositions in the inductive assumptions to imply the n+1 case, rather than being restricted to only the n th case. In some cases relating the n+1th case to the nth case may not be easy. The hint is that it is sufficient to relate the n+1 case to any one of the p(0), p(1), . .., p(n) cases - not necessarily the nth case, ie., if you can show that that the n+1 case is expressed in any one of these cases then you could invoke the inductive assumption. This is formally known as “strong” induction or “The Second Principle of Induction” - easier than ordinary induction (relating n+1 only to n). Note that it can be shown that ordinary and strong induction is equivalent. Problem 2 (5 points): Strong induction was used erroneously to prove that 2 n = 1 for all n 0. Show what is wrong with the following “proof ” (or if you prove it correct, maybe you’ll get the Nobel Prize in mathematics): BASIS STEP: 2 0 = 1 by definition (a 0 = 1 for any a). INDUCTIVE ASSUMPTION: assume that 2 k = 1 for all 0 k n, ie., assume 2 0 , 2 1 , 2 2 , … , 2 n are all equal to 1 for any n 0 INDUCTIVE STEP: 2 n+1 = (2 n )(2 n ) / (2 n-1 ) by the rules of exponents (“/ ” means “divide by”). But both 2 n and 2 n-1 fall within the range of the inductive assumption and may be replaced 1. Thus 2 n+1 = (1)(1)/1 = 1. Hence having “proved” the (n+1) th case, we conclude that 2 n = 1 for all n 0. QED! Problem 3 (10 points) Let T be a strictly binary tree ie., each vertex has precisely two children, except for the leafs which have no children. Assuming that the root and leafs count as vertices, prove that if T has n leafs, then the number of vertices, N, in T is exactly N = 2n-1. Use induction on the number of vertices, N in T. Hint: a strictly binary tree T can always be made up of the root of T and two “subtrees” each having roots consisting or the two vertices coming off the root of T. The sum of the leafs in the two subtrees add up to the number of leafs in T and the sum of the vertices in the subtrees plus 1 is the number of vertices in T. CS373 Homework assignment 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/07/2010 for the course COMPUTER S 138 taught by Professor Icamarra during the Spring '10 term at UCLA.

Page1 / 10

hw1f03-sol-post - CS373 Fall 2003 - NMG * Solution *post*...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online