Hacker News new | ask | show | jobs
by yablak 119 days ago
Is it faster to start by doubling?
1 comments

It depends on F, but usually, if F is like 2^n, then a single F(i) for a too large i, is slower than computing F(j) for all j < i.

This is illustrated by the fact that there are more leaves in a complete binary tree than all the other nodes summed.