This question is somehow broad, so I'll just give a minimal (abstract) example here:
We have 6 (= n ) vectors in our data set with d bits each. Suppose we are doing 2 (= n ) random permutations.
Let the first random permutation begin! Remember that we rearrange the bits, not the order of the vectors . After permuting the bits, they maintain order, for example:
v1 v5 v0 v3 v2 v4
Now the query query q appears, but it is (almost) unlikely to be the same with the vector in our dataset (after permutation), so we will not find it by performing a binary search.
However, we will end up between two vectors. So, now we can imagine the scenario to be like this (for example, q lies between v0 and v3:
v1 v5 v0 <-- up pointer <-- q lies here v3 <-- down pointer v2 v4
Now we move the pointer up or down, looking for the vector vi, which will correspond to the largest bits with q . Let them say that it is v0.
Similarly, we perform the second permutation and find the vector vi, say, v4. now we compare v0 with the first permutation and v4 to see which one is closest to q , i.e. which one has the most bits equal to q .
Edit:
Is it right to say that the total cost of performing N permutations is O (Nnlogn), since we must sort each of them?
If they really sort each permutation from scratch, then yes, but I donβt understand how they do it.
The permutation + sorting process described above is performed only once during pre-processing, or for each query q ?
ONCE .
At the last point, where we compare v0 and v4 with q , do we compare their permutation version or the original one (before their permutation)?
I think they do this with a rearranged version (see parentheses before 2N in the document). But this does not matter, since they rearrange q too, with the same permutation ( Ο ).
This quora answer may shed some light too.