edited by
396 views

1 Answer

Best answer
1 votes
1 votes

As it is not given that the array is sorted or unsorted , so we assume it to be unsorted as it is more generic case..So for median finding we mean that we need to find the (n/2) th element in the array if :

The array were sorted..

So this is done easily using selection procedure ; a variant of quicksort by setting k = n/2..Hence we can do the same in O(n) time..

Hence B) is the correct answer 

selected by

No related questions found