unknown Interview Question
Software Engineer / Developerswe will use max-heap or min heap..I am confused bcuz as a new data come and we take minimum of that(heap) and next is larger then we can remove lowest in heap. and insert it in heap of k.And again find minium and so on
3d plane = 3d space... but this is not important... :)
- S August 21, 2010is there a metric/distance like Euclidean metric?
It is not possible because you can't say when to finish - you have an infinite number of points. :)
A very simple alg: If infinite = a very large number, N, I'd use a max-heap of size k.
TC: O(N log k).
If you are looking for something more sophisticated, en.wikipedia.org/wiki/Nearest_neighbor_search