#python #sicp
We can think of a tree-recursive function as exploring different possibilities.
If you want to change selection, open document below and click on "Move attachment"
1.7 Recursive Functions-m, m) + count_partitions(n, m-1)
>>> count_partitions(6, 4)
9
>>> count_partitions(5, 5)
7
>>> count_partitions(10, 10)
42
>>> count_partitions(15, 15)
176
>>> count_partitions(20, 20)
627
<span>We can think of a tree-recursive function as exploring different possibilities.
In this case, we explore the possibility that we use a part of size m and
the possibility that we do not. The first and second recursive calls correspond
to these possibilities.
Im Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details