Find median of a row-wise sorted Matrix | GeeksforGeeks

Sdílet
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

Komentáře • 90

  • @sahilmalik2178
    @sahilmalik2178 Před 4 lety +73

    There is no point of a video lecture if you just read from the post.

  • @gauravchangmai8578
    @gauravchangmai8578 Před rokem +4

    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.

    • @forbidden4866
      @forbidden4866 Před 6 měsíci

      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.

  • @chintankothari8835
    @chintankothari8835 Před 3 lety +9

    And here i was thinking, i am the only one who is not getting.

  • @subhamshaw1726
    @subhamshaw1726 Před 3 lety +8

    At end the animated example really helped understand this approach, great

  • @gurpartapsingh1693
    @gurpartapsingh1693 Před 4 lety +148

    I bet no one can explain this worse than her!

    • @hritikchaudhary5470
      @hritikchaudhary5470 Před 3 lety +2

      best reply read ever.

    • @rachitjain4985
      @rachitjain4985 Před 3 lety +1

      @@hritikchaudhary5470 bhagwaanji samjhayenge kya fir

    • @janvimyadventures1310
      @janvimyadventures1310 Před 3 lety +1

      @@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

    • @enchantingbamboo
      @enchantingbamboo Před 2 lety

      Because, even she don't know what she is explaining.

  • @tarangsharma2650
    @tarangsharma2650 Před 3 lety +11

    another whjr teacher haha

  • @sandeepvedavyas8701
    @sandeepvedavyas8701 Před 4 lety +16

    Can anyone explain why the final result is guaranteed to be present in the matrix?

    • @vaishnavibhardwaj8033
      @vaishnavibhardwaj8033 Před 4 lety

      bcz r*c is odd.

    • @bhargavim9861
      @bhargavim9861 Před 4 lety

      @@vaishnavibhardwaj8033 can u explain little more clearly...(plz)

    • @vaishnavibhardwaj8033
      @vaishnavibhardwaj8033 Před 4 lety +1

      @@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.

    • @ayahassan326
      @ayahassan326 Před 3 lety

      @@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

    • @CrystalSergeant
      @CrystalSergeant Před 3 lety

      it is given in the problem statement that it is odd. 🤦‍♂️ it was bothering me as well

  • @surajrao4792
    @surajrao4792 Před 3 lety +5

    whats the point of video , we have eyes to check the same solution too if u just come to read whats written there

  • @darpansethi1939
    @darpansethi1939 Před 3 lety +4

    Uchi dukan feeka pakwaan proverb holds true

  • @ashutoshshrivastava6521
    @ashutoshshrivastava6521 Před 3 lety +5

    mam you are simply reading ppt and nothing else

  • @pradeepmondal4943
    @pradeepmondal4943 Před 3 lety +5

    Its appreciated that u have given ur best ,
    team GFG upload some good content , we expect best of best from u guys .

  • @jd_0p
    @jd_0p Před 5 měsíci

    what is the intuition behind that median is always min?

  • @onurcanisler
    @onurcanisler Před 4 lety +4

    I prefer to use nth_element method😼

    • @rishabsinha8749
      @rishabsinha8749 Před 3 lety

      How would you perform nth_element method, can you explain please?

  • @rishavraj9536
    @rishavraj9536 Před 4 lety +6

    What if min finally returned is not present in the matrix ? We are not checking for the presence of mid in the matrix.

  • @ridimamittal4064
    @ridimamittal4064 Před 3 lety +1

    upperbound koi smjha do plz

  • @shalomalexander7811
    @shalomalexander7811 Před 3 lety +12

    No guarantee that mid will be present in the matrix. Please make a doubt clearing video for this.

    • @savar33
      @savar33 Před 3 lety

      Exactly

    • @whiskeydonald4907
      @whiskeydonald4907 Před 2 lety

      That doubt clearing video will surely give us more doubts.

    • @gamingbar3881
      @gamingbar3881 Před 2 lety +2

      Abe bhai odd no. of elements hai toh median matrix ka hi koi element hoga

  • @Virtualexist
    @Virtualexist Před 2 lety +1

    Has anyone found an explanation on any other channel ?

  • @marysony7018
    @marysony7018 Před 3 lety +7

    is that even an explaination!?

  • @gaishiya7696
    @gaishiya7696 Před 3 lety

    excellent ma'am!!

  • @mohdrehan5332
    @mohdrehan5332 Před 3 měsíci

    Solve it with space complexity O(N).

  • @HemantKumar-zf5ui
    @HemantKumar-zf5ui Před 4 lety

    Very Good Explanation, Thanks

  • @dipuprasad9196
    @dipuprasad9196 Před 3 lety

    Please try to explain with an example

  • @tekbssync5727
    @tekbssync5727 Před 3 lety +4

    please make quality content video with proper explaination otherwise don't make

  • @sumitbaghel9987
    @sumitbaghel9987 Před 2 lety

    why total is odd not even like 4*4

  • @prashantbisht2219
    @prashantbisht2219 Před 2 lety

    So many loopholes in this question.

  • @akashsri3
    @akashsri3 Před 2 lety +4

    I can read the lines more better , if thats what you call explanation hire me geeks of geeks

  • @ankitgoyal8556
    @ankitgoyal8556 Před 4 lety +1

    It helped, thank you so much. Keep helping and motivating us.

  • @chiragsharma816
    @chiragsharma816 Před 3 lety

    Excellent video, Well explained

  • @imskr2683
    @imskr2683 Před 2 lety

    why are we not doing max = mid+1?

  • @praveenchandel5604
    @praveenchandel5604 Před 3 lety +3

    the worst explanation I have ever seen in my life. enable to understand anything.

  • @kewaltakhellambam7710

    what if 5 is not present? say A[0][2] = 6

    • @Coding4211
      @Coding4211 Před rokem

      Then answer would be 6.
      BC we are comparing position of mid in Matrix with position of median in sequence.

    • @kewaltakhellambam7710
      @kewaltakhellambam7710 Před rokem

      yes right. I have tried with various test cases. fascinating algorithm

  • @wildlifeicon6369
    @wildlifeicon6369 Před 2 lety +1

    youtube dislikes removal will be very useful for gfg tutorials ....😅😅

  • @thechallenginglife2272
    @thechallenginglife2272 Před 3 lety +1

    Excellent Explanation

  • @imskr2683
    @imskr2683 Před 2 lety

    thanks

  • @Itachibatman
    @Itachibatman Před rokem

    i didn't understood this one.

  • @shreedhargaming
    @shreedhargaming Před rokem

    First learn with gfg

  • @subrinasirajee530
    @subrinasirajee530 Před 3 lety +1

    The video explanation is not so good.

  • @arijitdas3299
    @arijitdas3299 Před 4 lety +1

    Hi

  • @codingworld3868
    @codingworld3868 Před 3 lety +1

    Hath jodke vinati hai krupiya humko hire karlo explain karne ke liye par aise video na upload karo

  • @yashstudio7396
    @yashstudio7396 Před rokem

    Isse badiya to batiti nahi👍

  • @udaykiransugali1139
    @udaykiransugali1139 Před rokem

    Dam Good mam

  • @aloktiwari9172
    @aloktiwari9172 Před 3 lety +5

    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.

  • @ranajitmukherjee9789
    @ranajitmukherjee9789 Před 3 lety +2

    Worse explanation ever

  • @kanavchopra7333
    @kanavchopra7333 Před rokem

    You were literally reading your presentation + code. Please improve upon your explanation.

  • @mohammadwahiduzzamankhan4397

    The most boring explanation I have ever seen for a problem discussion.

  • @atharvashukla9011
    @atharvashukla9011 Před rokem +1

    Very poor explanation

  • @kailashjangir1530
    @kailashjangir1530 Před 3 lety +1

    200th dislike done😂

  • @latestupdates8653
    @latestupdates8653 Před 8 měsíci

    Very bad explanation