Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
madcaptenor
· 7y ago · 0 comments
No, the size of the output is linear in the size of the input. (The Fibonacci numbers themselves grow exponentially, but the size of the output goes like the log of the number itself.)
Comments
[–]
romwell
7y ago
* linear in
input
, not
size of the input
:)
[–]
madcaptenor
OP
7y ago
You're right. I stand corrected.
[–]
ychen306
7y ago
You need O(log(n)) of bits to write down the input. So the output size is indeed exponential.
Size of input: O(log n)
Size of output: O(log(c^n)) = O(n)