CS 61A lect9 tree recusion
CS61A lect9 tree recusion
• Each cascade frame is from a different call to cascade.
• Until the Return value appears, that call has not completed.
• Any statement can appear before or after the recursive call.
Write a function that prints an inverse cascade:
1
12
123
1234
123
12
1
1 | def inverse_cascade(n): |
tree recursive
The computational process of fib evolves into a tree structure
汉诺塔:
1 | def move_disk(disk_number, from_peg, to_peg): |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
