3 ms·
if 4 <= N <= 16, then sqrt(N) <= log2(N) else sqrt(N) > log2(N) So, in Big-O term, this only trying to optimize only small dataset (4 <= N <= 16).
by herewhere 11y ago
if 4 <= N <= 16, then sqrt(N) <= log2(N)
else sqrt(N) > log2(N)
So, in Big-O term, this only trying to optimize only small dataset (4 <= N <= 16).
- spicyj 11y agoI mean, it depends on your data access patterns. Arrays are good for some things, trees are good for other things. Here's another option.
- teraflop 11y agoBig-O is only strictly meaningful in terms of asymptotic behavior; as soon as you start talking about specific values of N, you have to care about constant factors. In this case, the constant factors will probably be quite different because the goal is to make better use of CPU cache.