This is an example of a visual representation of a recursive algorithm. Procedures are boxes. Arguments are passed into procedures through the dark grey strip along the top, and results are deposited into the dark gray strip along the bottom. When a procedure is called, it gets nested in miniature inside the procedure that called it. "Flow of control" is displayed in cyan.
Fibonacci(
n
) = F(
n
,
0
,
1
)
F( n , a , b ) = if n > 0 then F( n-1 , b , a+b ) else a
|