Find median of a row-wise sorted Matrix | GeeksforGeeks
Vložit
- čas přidán 5. 04. 2020
- Our courses :
practice.geeksforgeeks.org/co...
This video is contributed by Meenal Aggarwal.
Please Like, Comment and Share the Video among your friends.
Install our Android App:
play.google.com/store/apps/de...
If you wish, translate into the local language and help us reach millions of other geeks:
czcams.com/users/timedtext_cs_p...
Follow us on Facebook:
/ gfgvideos
And Twitter:
/ gfgvideos
Also, Subscribe if you haven't already! :)
#likethisvideo #subscribe #geeksforgeeks
There is no point of a video lecture if you just read from the post.
Honestly, I don't think the code works mostly for the reason that it doesn't guarantee mid will house the exact median element since we are not using the exact median index neither does it check for the final mid value's presence (i.e median) in the matrix, at the end. Using min(=1) and max(=9) doesn't necessarily ensure that its median(=5) will be present in all possible matrices.
yup exactly I tried replacing 5 with 4 in the first array and it still returned 5 as output which is not present in the whole matrix.
And here i was thinking, i am the only one who is not getting.
At end the animated example really helped understand this approach, great
I bet no one can explain this worse than her!
best reply read ever.
@@hritikchaudhary5470 bhagwaanji samjhayenge kya fir
@@rachitjain4985 dekho bhai as you know ds algo is hard and can make you cry if you can refer to plalyist that will be good
Because, even she don't know what she is explaining.
another whjr teacher haha
hahaha
Can anyone explain why the final result is guaranteed to be present in the matrix?
bcz r*c is odd.
@@vaishnavibhardwaj8033 can u explain little more clearly...(plz)
@@bhargavim9861 see r*c is the total number of elements and given here that it's odd, and median for an odd number of elements will def be one of them. So the median def lies in the matrix if rows x columns i.e the total num of elements is odd.
@@vaishnavibhardwaj8033
s.findMedian(new int[][] {
new int[]{2},
new int[]{1},
new int[]{4},
new int[]{1},
new int[]{2},
new int[]{2},
new int[]{5}
});
will return 3 which don't exist in the matrix
it is given in the problem statement that it is odd. 🤦♂️ it was bothering me as well
whats the point of video , we have eyes to check the same solution too if u just come to read whats written there
Uchi dukan feeka pakwaan proverb holds true
mam you are simply reading ppt and nothing else
Its appreciated that u have given ur best ,
team GFG upload some good content , we expect best of best from u guys .
what is the intuition behind that median is always min?
I prefer to use nth_element method😼
How would you perform nth_element method, can you explain please?
What if min finally returned is not present in the matrix ? We are not checking for the presence of mid in the matrix.
Same doubt
its must return an element present in matrix because r*c is odd
@@UpdateWithAstro that is not necessary
same doubt
upperbound koi smjha do plz
No guarantee that mid will be present in the matrix. Please make a doubt clearing video for this.
Exactly
That doubt clearing video will surely give us more doubts.
Abe bhai odd no. of elements hai toh median matrix ka hi koi element hoga
Has anyone found an explanation on any other channel ?
trust me this is the best explanation
is that even an explaination!?
No cause its an explanation*
@@AdityaKumar-pp4xw Haa, ye karlo pehle ...😅
excellent ma'am!!
Solve it with space complexity O(N).
Very Good Explanation, Thanks
Please try to explain with an example
please make quality content video with proper explaination otherwise don't make
why total is odd not even like 4*4
So many loopholes in this question.
I can read the lines more better , if thats what you call explanation hire me geeks of geeks
It helped, thank you so much. Keep helping and motivating us.
Excellent video, Well explained
why are we not doing max = mid+1?
the worst explanation I have ever seen in my life. enable to understand anything.
what if 5 is not present? say A[0][2] = 6
Then answer would be 6.
BC we are comparing position of mid in Matrix with position of median in sequence.
yes right. I have tried with various test cases. fascinating algorithm
youtube dislikes removal will be very useful for gfg tutorials ....😅😅
Excellent Explanation
thanks
i didn't understood this one.
First learn with gfg
The video explanation is not so good.
Hi
Hath jodke vinati hai krupiya humko hire karlo explain karne ke liye par aise video na upload karo
Isse badiya to batiti nahi👍
Dam Good mam
To all those who are bashing gfg here.Guys this isn't a tutorial it's a solution explanation video.And,if u don't understand there must be something wrong with your head.Get it checked.
Worse explanation ever
You were literally reading your presentation + code. Please improve upon your explanation.
The most boring explanation I have ever seen for a problem discussion.
Very poor explanation
200th dislike done😂
Very bad explanation