I am in a situation where I have a query space Q and a key space K, both filled with N d-dimensional real vectors (N ≈ 10^6, d ≈ 50). For each query q, I want to find the k≈10 keys k_i that have the highest inner products with q. One may assume that both keys and queries are normally distributed.
It seems that getting the k nearest neighbours for one query should be possible in O(log N) time by creating some kind of binary search tree on the keys, which would lead to an O(N log N) time in total. And if query computations can be combined in some way, this could lead to a further speedup.
However, I have found no algorithm or implementation yet that advertises itself as being O(N log N). If there exists such an algorithm, could you provide a reference? If there does not, could you provide a reason(ing) for that?