锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品中文字幕无码AV,国产成人精品日本亚洲语音,亚洲乱码中文字幕综合http://www.tkk7.com/lzj520/category/38119.htmlzh-cnWed, 18 Nov 2009 23:01:24 GMTWed, 18 Nov 2009 23:01:24 GMT60091118姹傛潹杈変笁瑙掍腑鐨勯」http://www.tkk7.com/lzj520/archive/2009/11/18/302812.htmllzj520lzj520Wed, 18 Nov 2009 08:11:00 GMThttp://www.tkk7.com/lzj520/archive/2009/11/18/302812.html   int r=0;
  if(l==1|n==1|l==n){
   return 1;
  }else{
  return recursion(l-1,n-1)+recursion(l-1,n);
  }
 }

public static void main(String[] args){
System.out.println(recursion(7,4));
}

lzj520 2009-11-18 16:11 鍙戣〃璇勮
]]>
090310 Exercise 1.11. recursive process and iterativehttp://www.tkk7.com/lzj520/archive/2009/03/10/258516.htmllzj520lzj520Tue, 10 Mar 2009 00:51:00 GMThttp://www.tkk7.com/lzj520/archive/2009/03/10/258516.htmlhttp://www.tkk7.com/lzj520/comments/258516.htmlhttp://www.tkk7.com/lzj520/archive/2009/03/10/258516.html#Feedback0http://www.tkk7.com/lzj520/comments/commentRss/258516.htmlhttp://www.tkk7.com/lzj520/services/trackbacks/258516.htmlExercise 1.11.  A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative process.

recursive:

(define (fn n)
  (cond ((>= n 3) (+ (+ (fn (- n 1)) (* 2 (fn (- n 2)))) (* 3 (fn (- n 3)))))
        ((< n 3) n)
   ))


 iterative:

(define (re n)
  (if (< n 3)
      n
      (iter 2 1 0 n)
      ))
(define (iter a b c n)
(if(= n 3)
   (ca a b c)
   (iter (ca a b c) a b (- n 1))
   )
)
(define (ca a b c)
  (+ a (* 2 b) (* 3 c) )
)



lzj520 2009-03-10 08:51 鍙戣〃璇勮
]]>
090306 Exercise 1.8 cube-root procedureshttp://www.tkk7.com/lzj520/archive/2009/03/06/258241.htmllzj520lzj520Fri, 06 Mar 2009 08:22:00 GMThttp://www.tkk7.com/lzj520/archive/2009/03/06/258241.htmlhttp://www.tkk7.com/lzj520/comments/258241.htmlhttp://www.tkk7.com/lzj520/archive/2009/03/06/258241.html#Feedback0http://www.tkk7.com/lzj520/comments/commentRss/258241.htmlhttp://www.tkk7.com/lzj520/services/trackbacks/258241.html the cube root of x, then a better approximation is given by the value
(x/y2+2y)/3
Use this formula to implement a cube-root procedure analogous to the square-root procedure. (In
section 1.3.4 we will see how to implement Newton's method in general as an abstraction of these
square-root and cube-root procedures.)

(define (cube x)
  (* x x x))
(define (square x)
  (* x x ))
(define (result x y)
 (/ (+ (/ x (square y)) (* 2 y)) 3))
(define (improve  x guess)
  (result   x guess))
(define (good-enough?  x guess)
  (< (abs (- (* guess guess guess ) x))0.001))
(define (sqrt-iter x  guess)
  (if (good-enough?  x guess)
      guess
      (sqrt-iter x (improve  x guess)
                 )))

lzj520 2009-03-06 16:22 鍙戣〃璇勮
]]>
090306 Exercise 1.6 Square Roots by Newton's Methodhttp://www.tkk7.com/lzj520/archive/2009/03/06/258214.htmllzj520lzj520Fri, 06 Mar 2009 07:19:00 GMThttp://www.tkk7.com/lzj520/archive/2009/03/06/258214.htmlhttp://www.tkk7.com/lzj520/comments/258214.htmlhttp://www.tkk7.com/lzj520/archive/2009/03/06/258214.html#Feedback0http://www.tkk7.com/lzj520/comments/commentRss/258214.htmlhttp://www.tkk7.com/lzj520/services/trackbacks/258214.html can't I just define it as an ordinary procedure in terms of cond?'' she asks. Alyssa's friend Eva Lu
Ator claims this can indeed be done, and she defines a new version of if:
(define (new-if predicate then-clause else-clause)
  (cond (predicate then-clause)
        (else else-clause)))
Eva demonstrates the program for Alyssa:
(new-if (= 2 3) 0 5)
5
(new-if (= 1 1) 0 5)
0
Delighted, Alyssa uses new-if to rewrite the square-root program:
32(define (sqrt-iter guess x)
  (new-if (good-enough? guess x)
          guess
          (sqrt-iter (improve guess x)
                     x)))
What happens when Alyssa attempts to use this to compute square roots? Explain.


(define (new-if predicate then-clause else-clause)
(cond (predicate then-clause)
      (else-clause)))
(define (average x y)
  (/ (+ x y) 2))
(define (improve guess x)
  (average guess (/ x guess)))
(define (good-enough? guess x)
  (< (abs (- (square guess) x))0.001))
(define (square x)
  (* x x))
(define (sqrt-iter guess x)
  (new-if (good-enough? guess x)
          guess
          (sqrt-iter (improve guess x)
                     x)))

sqrt-iter (improve guess x)浣滀負鍙傛暟鏉ヤ紶閫掔粰new-if錛屽湪鎵цnew-if鐨勬椂鍊欙紝灝辨繪槸浼氭墽琛宻qrt-iter (improve guess x)錛岄犳垚浜嗘寰幆銆?br />



lzj520 2009-03-06 15:19 鍙戣〃璇勮
]]>
090305 Exercise 1.3 returns the sum of the squares of the two larger numbershttp://www.tkk7.com/lzj520/archive/2009/03/05/258058.htmllzj520lzj520Thu, 05 Mar 2009 11:56:00 GMThttp://www.tkk7.com/lzj520/archive/2009/03/05/258058.htmlhttp://www.tkk7.com/lzj520/comments/258058.htmlhttp://www.tkk7.com/lzj520/archive/2009/03/05/258058.html#Feedback0http://www.tkk7.com/lzj520/comments/commentRss/258058.htmlhttp://www.tkk7.com/lzj520/services/trackbacks/258058.html
(define (compare x y) (- x y))
(define (sumsquares x y)(+(* x x)(* y y)))
(define (returnlarge a b c)
  (cond ((and (>= (compare a b) 0) (>= (compare c b) 0)) (sumsquares a c))
        ((and (>= (compare a c) 0) (>= (compare b c) 0)) (sumsquares a b))
        ((and (>= (compare c a) 0) (>= (compare b a) 0)) (sumsquares b c))
         )
  )
(returnlarge 3 3 2)

>18

lzj520 2009-03-05 19:56 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 四虎免费大片aⅴ入口| **真实毛片免费观看| 免费久久精品国产片香蕉| 亚洲中文字幕一二三四区| 99精品国产免费久久久久久下载| 久久亚洲日韩精品一区二区三区| 免费91麻豆精品国产自产在线观看| 亚洲精品无码午夜福利中文字幕 | 亚洲福利在线播放| 精品亚洲成a人在线观看| 国产精品久久免费视频| 黄页免费视频播放在线播放| 4338×亚洲全国最大色成网站| 久久精品免费网站网| 亚洲美女又黄又爽在线观看| 久久精品视频免费看| 亚洲国产成人久久精品app| 成年女人看片免费视频播放器| 激情小说亚洲图片| 亚洲一级片免费看| 免费一级毛片无毒不卡| 亚洲伊人久久大香线蕉影院| 性感美女视频免费网站午夜| 女bbbbxxxx另类亚洲| 国产福利电影一区二区三区,亚洲国模精品一区 | 日韩在线一区二区三区免费视频 | 亚洲国产成人久久精品动漫| 亚洲免费二区三区| 亚洲精品美女久久久久久久| 亚洲国产精品碰碰| 久久免费区一区二区三波多野| 亚洲国产品综合人成综合网站| 免费无码不卡视频在线观看| av午夜福利一片免费看久久| 亚洲精品国产第1页| 国产大片91精品免费看3| 国产精品网站在线观看免费传媒| 中文字幕在线日亚洲9| 亚洲中文字幕无码永久在线| 久草视频在线免费| 一个人看的免费视频www在线高清动漫|