algorithm - Median of medians is not the real median. Correct? -


personally, think median of medians not real median. correct?
so if above statement true, why using median of medians pivot partition array find kth min elem's time complexity worst case o(n)? "n" num of elems.

median of medians indeed approximation, not actual median.

it used optimization, calculate pivot partition of array in algorithms quicksort or quickselect, such worst case complexity of o(n^2) avoided.

wikipedia article it, saying:

although approach optimizes quite well, typically outperformed in practice instead choosing random pivots, has average linear time selection , average linearithmic time sorting, , avoids overhead of computing pivot.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -