If array is sorted we can generally find median in O(1) by returning the element at the middle. But what if there are duplicates?
E.g [2, 2, 3, 3, 3, 3]
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
Yes. Even with duplicates, the process of finding median is same. See this link - https://math.stackexchange.com/questions/1191119/how-to-find-the-median-of-three-numbers-if-one-of-them-appears-twice