SICP 1.2.3
Posted on 2015-02-12 20:42:17 +0900 in SICP
Time and space complexity is kind of difficult for me.
1.14
To analyze the time complexity of $cc(n, k)$, it is more easy to start from $k=1$
if $k=1$, then $cc(n, 1)=O(n)$
if $k=2$, then $cc(n, 2) = cc(n - 5, 2) + cc(n, 1) = O(n^2)$
…
By induction, $cc(n, 5)=O(n^5)$
1.15
Time complexity is about $log_3(n)$.
Hide Comments
comments powered by Disqus