Friday 27 November 2020

Fastest algorithm for Kth smallest Element (or median) finding on 2 Dimensional Array?

I see lots of SO topics on related topics but non of them can handle the efficient way.

we are want to finding k-th smallest element (or median) on 2D array [1..M][1..N] where each rows of this matrix is sorted in ascending order and all elements are distinct.

I think there is O(M log MN) solution is the best ones, but no idea about implementation. (Median of Medians or Using Partition with Linear Complexity is some method but no idea any more...).

This is Old- Google Interviews Question and can be searched on Here.

But now I want hint or describe the most efficient algorithm (the fastest one).

alos I read a paper on Here but nothing can be understand.

Update 1: one solution is found here but when dimension is odd.



from Fastest algorithm for Kth smallest Element (or median) finding on 2 Dimensional Array?

No comments:

Post a Comment