3 ms·
Interesting. One layout they did not consider is the bit-reversal permutation[1] of the sorted array. Searching is straightforward: to find element i, you rever
by mtdewcmu 11y ago
Interesting. One layout they did not consider is the bit-reversal permutation[1] of the sorted array. Searching is straightforward: to find element i, you reverse the bits of i -- so then, you can just binary search. This layout is similar to Eytzinger, so it should perform at least as well, and it may have some advantages.
[1]https://en.wikipedia.org/wiki/Bit-reversal_permutation https://en.wikipedia.org/wiki/Bit-reversal_permutation