3 ms·
> [...] what N must count. Traditionally, it counts comparisons, swaps, or other algorithmic events. Er, N is counting the input elements (eg number of nodes i
by a1369209993 7y ago
> [...] what N must count. Traditionally, it counts comparisons, swaps, or other algorithmic events.
Er, N is counting the input elements (eg number of nodes in a graph, array length, etc), O() is what counts algorithmic or microarchitectural events.
> Similarly, "if (c) a -= b;" may become "a -= (-c & b);".
Reminds me of speeding up a ECC loop by almost two orders of magnitude with (basically):
- if(i&(1<<k)) p ^= parity(x[i])<<k;
+ p32[k] ^= x[i] & -(ii&1); ii>>=1;