• <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 丑石 閱讀(293) 評(píng)論(0)  編輯 收藏 引用 所屬分類: Algorithm and Data Structure


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            My Links

            Blog Stats

            News

            常用鏈接

            留言簿(1)

            隨筆分類(13)

            隨筆檔案(17)

            文章檔案(1)

            相冊(cè)

            收藏夾(1)

            Friends' blog

            useful sites

            搜索

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            欧美久久一区二区三区| 久久综合狠狠色综合伊人| 狠狠色噜噜色狠狠狠综合久久| 青青草原综合久久大伊人精品| 精品综合久久久久久98| 久久久久久国产精品免费免费| 国产情侣久久久久aⅴ免费| 色综合久久无码中文字幕| 国内精品久久国产| 亚洲婷婷国产精品电影人久久| 国产精品无码久久久久| 国内精品久久久久久久久电影网| 狠狠色丁香婷综合久久| 久久久久久久99精品免费观看| 久久国产精品77777| 亚洲一区中文字幕久久| 久久综合亚洲色HEZYO社区| 伊人久久大香线蕉综合热线| 亚洲综合久久夜AV | 久久久久久亚洲精品影院| 狠狠色丁香婷婷久久综合| 一本色道久久综合| 亚洲国产精品无码久久久不卡| 亚洲精品美女久久久久99| 99久久99久久| 精品久久久久久国产免费了| 亚洲国产小视频精品久久久三级| 久久这里有精品| 久久精品无码专区免费东京热| 国产成人久久精品激情 | 久久精品中文字幕久久| 99久久免费只有精品国产| 欧美精品福利视频一区二区三区久久久精品 | 日韩精品国产自在久久现线拍| 精品久久久久久综合日本| 久久久久亚洲精品日久生情| 日产精品久久久久久久| 久久黄色视频| 日韩精品久久久肉伦网站| 久久久久久久尹人综合网亚洲 | 久久人妻少妇嫩草AV无码专区|