Hi! Facing this doubt:
Wanted to ask:
Why are we including permutations here? If I change the position of for example 5,5,6 to make it 6, 5, 5 – the list is no longer in ascending order of values (is that okay?) OR 5, 6, 5 – wherein 5 is no longer the median.
Would be great if you can help, thanks!
Yup! Understand that in a list, order matters, and it could be ascending / descending order.
But do cases like for e.g. 5, 6, 5- not contradict the basic condition of the question that the median should be 5?
There is no requirement that the numbers in the list must be already sorted, so you need to do it yourself.
Still not able to grasp why we are considering cases where numbers other than 5 lie in the middle and are the median, when the question says that 5 has to be the median. \
Could you please help me understand why cases such as: 5,6,5; 5,9,5; 5,3,5- are valid? Also confusion is coming from the fact that in such cases, the right most number is either < median; or leftmost number is greater than median- this is also not against how a list where we are evaluating median should be set up?
Take a step back. What is the median of the list [5, 6 5]?
Aah! I was getting so unnecesarily confused.
Understood now that the list can be unique, and then we can ourselves find mode by rearranging this list numbers.
Thank you for your patience!