Suppose I have a set A of n numbers.
Given a number x, I wish to choose a subset B of A such that B has the m elements of A that are closest (numerically) to x.
I would like to do this as fast as possible. I would prefer not to sort A first, but if I needed to, I could not sort in place (thus doubling the size of ram required).
Given a number x, I wish to choose a subset B of A such that B has the m elements of A that are closest (numerically) to x.
I would like to do this as fast as possible. I would prefer not to sort A first, but if I needed to, I could not sort in place (thus doubling the size of ram required).