I recently wrote a program after analyzing the k-th smallest element algorithm, first without the case of duplicates.
Now, however, I would like to analyze the expected asymptotic runtime for finding, say, the median of an array when there are exactly j
duplicates. I haven't modified my code for such, and thus the performance slows down a bit because of the j
duplicates.
I'm not sure how to begin? Can anyone point me towards such a recurrence relation?
I've derived the following, where n is the size of the input array
T(n) <= 1/2*T(3/4*n) + 1/2*T(n)
but am quite unclear how to proceed with duplicate keys involved.
Thanks