• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            linux&c++ R&D

            programing is a pleasure!

            Thinking recursively

            First,Let's know the principle:
            Recursive leap of faith-
            When you try to understand a recursive program,you must be able to put the underlying details aside and focus instead on a single level of the operation. At that level,you are allowed to assume that any recursive call automatically gets the right answer as long as the arguments to that call are simpler than the original arguments in some respect.The psychological strategy-assuming that any simpler recursive call will work correctly-is called the recursive leap of faith!
            The idea may be difficult to newers! Take an example for it:
            We all know the Fibonacci function:
            F(n)=F(n-1)+F(n-2)
            Recursive implementation of the Fibonacci funtion:

            int Fib(int n){
            if (n<=1)
               
            return n;
             
            else
               
            return Fib(n-1)+Fib(n-2);
            }

             if n is 5,Fib(5) is computed by the sum of Fib(4) and Fib(3).
            Applying the faith,you can assume that  the program correctly computes each of these values,without going through all the steps that Fib(4) and Fib(3) is computed!

            posted on 2008-03-16 18:54 丑石 閱讀(296) 評論(0)  編輯 收藏 引用 所屬分類: Algorithm and Data Structure

            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久99国内精品自在现线| 麻豆精品久久久久久久99蜜桃| 777米奇久久最新地址| 久久久久一区二区三区| 久久精品国产亚洲Aⅴ蜜臀色欲| 国产成人精品综合久久久| 亚洲国产精品久久久久婷婷软件 | 久久99精品国产自在现线小黄鸭 | 99精品久久久久久久婷婷| 色噜噜狠狠先锋影音久久| 精品久久久久久久久免费影院 | 久久综合给合综合久久| 午夜天堂精品久久久久| 色8激情欧美成人久久综合电| 久久er热视频在这里精品| 色综合久久久久综合体桃花网| 国产激情久久久久影院小草| 久久久久亚洲av无码专区喷水| 久久综合九色综合久99| 久久99国产精品久久| 国产成人久久精品一区二区三区| 精品久久久久久无码中文野结衣| 久久精品成人免费看| 久久久久高潮毛片免费全部播放| 久久人人爽人人爽人人片AV高清| 色欲综合久久躁天天躁| 国内精品伊人久久久久网站| 久久本道伊人久久| 国产91色综合久久免费| 天天躁日日躁狠狠久久| 奇米综合四色77777久久| 国产精品99久久久精品无码 | 久久精品18| 亚洲国产精品综合久久网络| 久久久WWW成人免费精品| 久久久久国产视频电影| 精品国产热久久久福利| 欧美麻豆久久久久久中文| 久久精品国产72国产精福利| 色婷婷狠狠久久综合五月| 国产精品一区二区久久精品涩爱|