Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 15 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
15
Dung lượng
244,87 KB
Nội dung
Strong Induction 2/27/12 Induction Rule R(0) and (" n)(R(n)fi R(n+1)) R(0),(" R(1m ), R(2),…,R(n),… )R(m) 2/27/12 Strong Induction Rule R(0) R(0), R(0) I MPLI ES R(1),R(0) &R(1) I MPLI ES R(2), and ("&R(1 n)(R(0) &º R(0) ) &R(2) I MPLI&R(n)fi ES R(3),K R(n+1)) R(0), R(1), R(2),…,R(n),… (" m)R(m) 2/27/12 Fibonacci Numbers • • • • Start with a pair of rabbits After months a new pair is born Once fertile a pair produces a new pair every month Rabbits always come in breeding pairs, and never die http://morrischia.com/david/portfolio/boozy/research/fibonacci's_20rabbits.html 2/27/12 Fibonacci Numbers • • • • • • 0, 1, 0+1=1, 1+1=2, 1+2=3, 2+3=5, 3+5=8, … Fn+1=Fn+Fn-1 (n≥1) F0=0 F1=1 2/27/12 How Many Binary Strings of length n with No Consecutive 1s? n 2/27/12 1 00 01 10 11 000 001 010 011 100 101 110 111 How Many Binary Strings of length n with No Consecutive 1s? n 2/27/12 1 00 01 10 11 000 001 010 011 100 101 110 111 How Many Binary Strings of length n with No Consecutive 1s? n 2/27/12 1 00 01 10 11 000 001 010 011 100 101 110 111 How Many Binary Strings of length n with No Consecutive 1s? n 2/27/12 1 00 01 10 11 000 001 010 011 100 101 110 111 How Many Binary Strings of length n with No Consecutive 1s? n 1 00 01 10 11 000 001 010 011 100 101 110 111 1, 2, 3, 5, … ? Are these the Fibonacci numbers?? 2/27/12 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 10 Cn = #Binary Strings of length n with No Consecutive 1s n Cn n Fn 1 Cn = Fn+2?? Why would that be? Say that a string is “good” if it has no consecutive 1s Why would a “good” string of length n+1 have something to with good strings of shorter length? 2/27/12 11 Getting Good Strings of Length n+1 A good string of length n+1 ends in either or Call this good string x [Try breaking the problem down into cases] If x ends in 0, the first n digits could be any good string of length n since adding a to the end can’t turn a good string bad There are Cn strings like that x Good string of length n 2/27/12 12 Getting Good Strings of Length n+1 If x ends in 1, the next to last digit must be (otherwise x would end in 11 and be bad) But the previous n-1 digits could be any good string of length n-1 There are Cn-1 strings like that Total = Cn+1 = Cn+Cn-1 x Good string of length n-1 2/27/12 13 Proof by Induction that Cn=Fn+2 (Base cases) C0 = = F0+2 C1 = = F1+2 (Induction hypothesis) Assume n≥1 and Cm=Fm+2 for all m≤n Need to show that Cn+1 = Fn+3 Then Cn+1 = Cn+Cn-1 (by previous slide) = Fn+2+Fn+1 (by the induction hypothesis) = Fn+3 by defn of Fibonacci numbers 2/27/12 14 Finis 2/27/12 15 ... that Cn=Fn+2 (Base cases) C0 = = F0+2 C1 = = F1+2 (Induction hypothesis) Assume n≥1 and Cm=Fm+2 for all m≤n Need to show that Cn+1 = Fn+3 Then Cn+1 = Cn+Cn-1 (by previous slide) = Fn+2+Fn+1 (by