Counting inversions

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • To access the translated content:
    1. The translated content of this course is available in regional languages. For details please visit nptel.ac.in/translation
    The video course content can be accessed in the form of regional language text transcripts, books which can be accessed under downloads of each course, subtitles in the video and Video Text Track below the video.
    Your feedback is highly appreciated. Kindly fill this form forms.gle/XFZhSnHsCLML2LXA6
    2. Regional language subtitles available for this course
    To watch the subtitles in regional languages:
    1. Click on the lecture under Course Details.
    2. Play the video.
    3. Now click on the Settings icon and a list of features will display
    4. From that select the option Subtitles/CC.
    5. Now select the Language from the available languages to read the subtitle in the regional language.

Komentáře • 9

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

    Excellent explanation! This is the BEST explanation of how to count inversions using a merge sort type algorithm that I have found!

  • @mishkamn
    @mishkamn Před 5 lety +2

    Very good straight to the point and clear

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

    If courses are bollywood, NTPEL is the Irfan Khan of it.

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

    Thanks a lot sir!

  • @AbhishekChaturvedi7
    @AbhishekChaturvedi7 Před 4 lety

    superb explanation

  • @0anant0
    @0anant0 Před 3 lety

    Very nice explanation. Leetcode 493 is based on this.

  • @pranavyeleti3499
    @pranavyeleti3499 Před 3 lety

    sir countR,R should be mergesortcount(A,mid+1,right).i have a dought.correct me if i am wrong

  • @cowboymc8230
    @cowboymc8230 Před 4 lety

    What I don't understand is the part : sort and count inversions in L and R. I mean since you sort L and R already, the count of inversions in either L or R would be 0, isn't it?

    • @0anant0
      @0anant0 Před 3 lety +2

      Those recursions occur during the "merge" portion of the L and R halves. The very act of sorting L and R involves 'merge'
      e.g.
      cInv += mergeSort(lo to mid)