Just wanted to point out that at about minute 11:30 into the video, I said the value of hi=N, where in fact it's (N-1). It's the confusion that sometimes happen when you switch between 0-based index in C like languages and 1-based index like when you use pseudo code for example. Apology for that mistake
at around 1:15 , if the array size of Z is 2n , which is an even number, then the median m should be the average of two elements in middle. That means there should be n-1 elements smaller , and n-1 (NOT n) elements bigger than the median number. right ?
I think this algorithm works in general cases. But it seems very vulnerable to exception case, like index out of bound error, etc. That inequality for median can be true only if there is an existing element at index n - i + 1 and n - i
Just wanted to point out that at about minute 11:30 into the video, I said the value of hi=N, where in fact it's (N-1). It's the confusion that sometimes happen when you switch between 0-based index in C like languages and 1-based index like when you use pseudo code for example. Apology for that mistake
Thank you for the great explanation! Please do add more videos! :)
at around 1:15 , if the array size of Z is 2n , which is an even number, then the median m should be the average of two elements in middle. That means there should be n-1 elements smaller , and n-1 (NOT n) elements bigger than the median number. right ?
Thanks!
I think this algorithm works in general cases. But it seems very vulnerable to exception case, like index out of bound error, etc. That inequality for median can be true only if there is an existing element at index n - i + 1 and n - i
I agree, but the focus was kind of to demonstrate the idea vs tightening up all error handling cases. Thanks for watching :)