最简单的解递归的方法一回朔 T(1)=1 T(n)=2T(n-1)+1 T()-2T(-1)+ 2T(m-1)=4T(n-2)大2 4Tm-2)=8Tm-3)+4人 Tn)=2"-1 2m-2T(2)(2m-1T(1)+2n-2
最简单的解递归的方法 – 回朔
递归思维:直线划分平面 口问题: ·n条直线(无限长)最多能将平面分为多少个区域(包括 有限与无限区域)? 怎样能使划分的区 域尽可能得多? L(0)=1 L(n)=L(n-1)+n Line n
递归思维:直线划分平面 ❑ 问题: ◼ n 条直线(无限长)最多能将平面分为多少个区域(包括 有限与无限区域)? Line n 怎样能使划分的区 域尽可能得多? L(0) = 1 L(n) = L(n-1) +n
用回朔的办法解递归 L(m)=L(-1)+n =L(n-2)+(n-1)+n =L(n-3)+(m-2)+(n-1)+n =L(0)+1+2+..+(n-2)t(n-1)tn L(m=n(n+)/2+1
用回朔的办法解递归 L(n) = L(n-1)+n = L(n-2)+(n-1)+n = L(n-3)+(n-2)+(n-1)+n = …… = L(0)+1+2+……+(n-2)+(n-1)+n L(n) = n(n+1)/2 + 1
递归思维:Josephus问题 Live or die,it's a problem! Legend has it that Josephus wouldn't have lived to become famous without his mathematical talents.During the Jewish Roman war,he was among a band of 41 Jewish rebels trapped in a cave by the Romans.Preferring suicide to capture,the rebels decided to form a circle and,proceeding around it,to kill every third remaining person until no one was left.But Josephus,along with an unindicted co-conspirator,wanted none of this suicide nonsense;so he quickly calculated where he and his friend should stand in the vicious circle. We use a simpler version: “every second
递归思维:Josephus 问题 ◼ Live or die, it’s a problem! ◼ Legend has it that Josephus wouldn't have lived to become famous without his mathematical talents. During the Jewish Roman war, he was among a band of 41 Jewish rebels trapped in a cave by the Romans. Preferring suicide to capture, the rebels decided to form a circle and, proceeding around it, to kill every third remaining person until no one was left. But Josephus, along with an unindicted co-conspirator, wanted none of this suicide nonsense; so he quickly calculated where he and his friend should stand in the vicious circle. We use a simpler version: “every second