mergesort

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

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

  • @pgudipati555
    @pgudipati555 7 лет назад +5

    Just wondering, where can I find the lecture-handout (PDF) of this lecture, for download?

  • @bejorrani
    @bejorrani 2 года назад +5

    A shorter Program for Merge Sort. Using recursion without much variables and also usible one of the combine as given in the wrongmergesort program.
    def mergesort(seq):
    k=len(seq)
    if k==1:
    return seq
    else:
    return Merge(mergesort(seq[:k//2]),mergesort(seq[k//2:]))
    def Merge(seq1,seq2):
    C,m,n,i,j=[],len(seq1),len(seq2),0,0
    while i+j

  • @ayushganguli1359
    @ayushganguli1359 5 лет назад +5

    Not the right program sir. I have tried this program several times and it only returns me a singleton list. I guess problem is there in the first if statement in mergesort function

  • @RA-oo4lj
    @RA-oo4lj 5 лет назад +1

    Best explanation ever!

  • @keshavmaheshwari6420
    @keshavmaheshwari6420 4 года назад +1

    If I give input list 38 27 43 3 9 82 10
    The output I get is 3 9 38 27 43 82 10

    • @exploringMyself998
      @exploringMyself998 4 года назад +1

      Here, he is just merging the two sorted list in a sorted order,
      but is not using any divide and conquer strategy. For your input write divide and conquer program and then apply merge sort.

  • @sasikumar6378
    @sasikumar6378 5 лет назад +2

    Explain ,if right - left

    • @vaishnaves1723
      @vaishnaves1723 4 года назад +4

      So right and left are indices right? right - left

    • @arungandhi5612
      @arungandhi5612 4 года назад +1

      Left Is the first index right is the last index, if left and right are the same then there is only 1 element. If left and right differ by 1 there are 2 elements. So sorting a single element or 2 elements is very is. For eg sort 5 will return 5, and sort 4,5 will return 4,5

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

      @@vaishnaves1723 how can i consider no element either ther is 3 is present or 2 element is present(3,4)

  • @nikhilpatil2482
    @nikhilpatil2482 4 года назад +1

    1st method is cool but second is .......................

  • @ByteSizeHacks043
    @ByteSizeHacks043 3 месяца назад +1

    Worst explanation ever
    He's assuming everyone know these programs before hand and explaining things without stop not even thinking whether the people watching will understand or not