Download presentation
Presentation is loading. Please wait.
Published byAntony Linden Modified over 9 years ago
2
Value is 1 Let x = FIBO(n-1)Let y = FIBO(n-2)x + y endbegin n > 2 n =1 or 2 RTN for Fibonacci numbers FIBO(n) begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 4 Let x = FIBO(n-1) begin Let x = FIBO(n-1) Let x = FIBO(3)
3
RTN for Fibonacci numbers begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 3 Let x = FIBO(n-1) Let x = FIBO(n-1) Let x = FIBO(2) begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 2 Let x = FIBO(n-1) Value is 1 end begin Result = 1
4
RTN for Fibonacci numbers begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 3 begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 2 Let x = FIBO(n-1) end Result = 1 Let x = FIBO(n-1) Let x = 1 Let y = FIBO(n-2) Let y = FIBO(1)
5
RTN for Fibonacci numbers begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 3 begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 1 Let x = FIBO(n-1) Let x = FIBO(n-1) Let x = 1 Let y = FIBO(n-2) Let y = FIBO(1) begin Value is 1 end Result = 1
6
Let y = FIBO(n-2) Let y = 1 RTN for Fibonacci numbers begin Value is 1 x + y end n > 2 n =1 or 2 FIBO(n) n = 3 begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 1 Let x = FIBO(n-1) Let x = FIBO(n-1) Let x = 1 Let y = FIBO(n-2) Let y = 1 end Result = 1 x + y 1 + 1 end Result = 2
7
Value is 1 Let x = FIBO(n-1)Let y = FIBO(n-2)x + y endbegin n > 2 n =1 or 2 RTN for Fibonacci numbers FIBO(n) begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 4 Let x = FIBO(n-1) Let x = 2 Let x = FIBO(n-1) Let x = FIBO(3) Let x = FIBO(n-1) Let x = 2 Let y = FIBO(n-2) Let y = FIBO(2)
8
RTN for Fibonacci numbers begin Value is 1 Let y = FIBO(n-2)x + y end n > 2 n =1 or 2 FIBO(n) n = 2 Let x = FIBO(n-1) Value is 1 end begin Result = 1
9
Value is 1 Let x = FIBO(n-1)Let y = FIBO(n-2)x + y endbegin n > 2 n =1 or 2 RTN for Fibonacci numbers FIBO(n) begin Value is 1 x + y end n > 2 n =1 or 2 FIBO(n) n = 4 Let x = FIBO(n-1) Let x = 2 Let y = FIBO(n-2) Let y = 1 Let y = FIBO(n-2) Let y = FIBO(2) Let y = FIBO(n-2) Let y = 1 x + y
10
Value is 1 Let x = FIBO(n-1)Let y = FIBO(n-2)x + y endbegin n > 2 n =1 or 2 RTN for Fibonacci numbers FIBO(n) begin Value is 1 2 + 1 end n > 2 n =1 or 2 FIBO(n) n = 4 Let x = FIBO(n-1) Let x = 2 Let y = FIBO(n-2) Let y = 1 2 + 1 end 3 FIBO(4) = 3
11
Recursive definitions vs circular definitions This is the crucial fact [that] distinguishes recursive definitions from circular ones. There is always some part of the definition [that] avoids self-reference. GEB, p.133 Study Question 8 B. To make a series of concentric circles, draw a circle with a radius of one unit, then draw other circles with the same center and a radius of one unit greater than that of the previous circle. How to make this circular?
12
Recursive definitions vs circular definitions This is the crucial fact [that] distinguishes recursive definitions from circular ones. There is always some part of the definition [that] avoids self-reference. GEB, p.133 Study Question 8 C. To understand a sentence: (a) Read the first unread word in a sentence, (b) understand its meaning, (c) go back to step (a). How to make this circular?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.