zoukankan      html  css  js  c++  java
  • Exercises of Concrete Mathematics

        1.1  At first,the proof seems perfect!Horses 1 through n-1 are the same color,and horses2 through n are the same color,
    but when the n=2 ,that 1 and 1 are same color, 2 and 2 are same color,so it can't induction that all horses are same color.
    The basis of this inducation is wrong!It should from n=2 no n=1!
        1.2 This exercise is variant of Hanoi Tower.
            T(0)=0
            Because it direct move between A and B are disallowed,We can first move T(n-1) from A to B,the move the largest
            disk to C(Move from A to B is disallowed),then move T(n-1)  from B to A,then move the largest disk in C to B,then
            remove the T(n-1) in A to B,so maximum moves is : T(n-1)+1+T(n-1)+1+T(n-1)
            T(0) = 0
            T(n) = 3T(n-1)+2
            Ok,Let's convert the recurrence  to a "closed form":
            We add 1 to both sides of equations:
            T(0) + 1 = 1;
            T(n) + 1 = 3T(n-1)+3
            Then we let U(n) = T(n)+1, we get :
            U(0) = 1;
            U(n) = 3(T(n-1)+1) = 3U(n-1))
            so the closed form is :  T(n) = 3^n -1
  • 相关阅读:
    数据结构学习
    古兰查询 之查询页面隐藏
    Qt只QSetting
    学习下知然网友写的taskqueue
    producter-consumer 他山之石
    unix缓冲
    Buffering of C streams
    POCO Log库
    linux下open和fopen的区别
    dup2替换
  • 原文地址:https://www.cnblogs.com/cc011/p/1013205.html
Copyright © 2011-2022 走看看