Merge Sort in Java - Part 4 | Implementation | Sorting Algorithms

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 18

  • @gauravpise4628
    @gauravpise4628 3 года назад +5

    Sir you are a great teacher. I am learning data structure from your videos❤🙏

    • @itsdineshvaryani
      @itsdineshvaryani  3 года назад +3

      Thanks !!! I would request you to share it with ur friends and colleagues.

  • @anupambasak4223
    @anupambasak4223 3 года назад +3

    Thank you sir :) Before starting this course/playlist I was really demotivated how will I manage DSA! But now I'm a bit confident in this topic :) Thank you again sir...

  • @sathoshreddy
    @sathoshreddy Год назад +1

    Thanks sir i can easily understandable your vedios thanks sir this is great tutorial to learn datastructures thanks you sir

  • @aniketraj67
    @aniketraj67 3 года назад +2

    kya ap bata paynge or kitne videos banne baki hai..Matlab ki kitne topics abhi baki hai??

    • @itsdineshvaryani
      @itsdineshvaryani  3 года назад +1

      Its endless topic ... I will keep on updating the playlist ... So far most of the topics are there

  • @alamelu85
    @alamelu85 2 года назад +1

    Dinesh - One question - In the merge method, why was the first array exhausted (low to mid) and second array (mid+1 to high) remaining not considered? I did not get that.

    • @raghu9460
      @raghu9460 11 месяцев назад

      Because initially in the merge method we are copying the elements from arr to temp. In arr elements are sorted from low to mid and mid+1 to high, so while merging we are again traversing low to mid with the help of i variable and mid+1 to high with the help of j variable in the temp array and comparing temp[i] & temp[j] whichever is less we are filling them into arr and incrementing So when left sub array got exhausted and right sub array go remained means all the elements remained in the right subarray are greater than the elements of left sub array and some elements of right subarray, but if we observe they are already present to the end of the arr array so we need not again copy them even if we copy them again we will get the same result. But it is not the case of the left subarray elements if it remained means initially those values are at near mid of arr and got replaced while merging and these leftover values in the left subarray must be filled at the end of the 'arr' array with the help of while loop which sir have given as they are already sorted.

  • @yarik83men51
    @yarik83men51 2 года назад +1

    Excellent

  • @mrunaligaikwad1953
    @mrunaligaikwad1953 3 года назад +1

    Hi Dinesh, as we are not using the temp array for sorting method, it is just used for merging, what is the use of sending it in the sort method input parameter?

    • @itsdineshvaryani
      @itsdineshvaryani  3 года назад

      you need to then add temp as instance level variable ... or else without sending to sort you can pass to merge !!!

  • @suvajitpaul4999
    @suvajitpaul4999 3 года назад +2

    Very nice

  • @likhithanadithoka1389
    @likhithanadithoka1389 3 года назад +1

    Thank you