Correction at 05:58 --> "the index of element 3 is smaller than the index of element 2." Correction at 10:53 --> "Time Complexity for Simple Method is O(n^2)." [It can also be written as O(n*n)]
in the video 08.50 it is "we add the inversion count returned by these two respective calls to inversion count variable". But I am seeing only in the last call inv_count += _mergeSort(arr,temp,mid+1,right) is there
Thanks for pointing it out, Goutam. You're right, it's a typo. There should be a plus sign there. The statement should look like this: inv_count += _mergeSort(arr, temp, left, mid);
Samjhane ke liye dhanyavaad. kya aap yeh bta sakte hain ki agar merge sort aur enhanced merge sort ki same time complexities hain to dono me se konsi behtar hai? Agrim Dhanyavaad.
I am unable to dry run the following two lines of code inv_count += _mergeSort(arr, temp, left, mid); inv_count += _mergeSort(arr, temp, mid + 1, right); in _mergesort. Pls help
For a more thorough description, I recommend consulting Kleinberg and Tardos: Algorithm Design (the PDF is one of the first results on Google). The relevant text is Chapter 5 - Divide and Conquer, and the section is 5.3 - Counting Inversions. This video helped me understand that section, but I wouldn't have been able to figure it out without both the text and the video.
This is awesome. I come here from an algorithm course from Stanford. Your explanation is clearer.
Correction at 05:58 --> "the index of element 3 is smaller than the index of element 2."
Correction at 10:53 --> "Time Complexity for Simple Method is O(n^2)." [It can also be written as O(n*n)]
Thanks for the video, should we also count the inversion happened before merge started??
in the video 08.50 it is "we add the inversion count returned by these two respective calls to inversion count variable". But I am seeing only in the last call inv_count += _mergeSort(arr,temp,mid+1,right) is there
Thanks for pointing it out, Goutam. You're right, it's a typo. There should be a plus sign there. The statement should look like this:
inv_count += _mergeSort(arr, temp, left, mid);
Amazing amazing explanation with examples, thank you so much
Please increase the volume level, its quite less for hearing & understanding
its fine increase yours.
thanks for the awesome video, I learned a lot and in a very short period of time ;)
hi,
the method 1 described in the code , shouldn't the condition be if((arr[i] > arr[j])&&(i
No, since the inner loop runs from j=i+1 so the (i
Nice explanation. Liked it.
does this work for duplicate numbers in an array?
why do we add mid-i to inv_count??
you are the best!!!
just amazing
Very helpful!
geek4geeks u guys awesome
Why did you take "temp" array?
Merge karenge to extra , to merged to temp le lete apan kyu ki inplace merging nhi kr sakte
Samjhane ke liye dhanyavaad.
kya aap yeh bta sakte hain ki agar merge sort aur enhanced merge sort ki same time complexities hain to dono me se konsi behtar hai?
Agrim Dhanyavaad.
enhanced one is just for the purpose of counting inversions in array
Thanks a Lot Sir..
You're welcome!
Thanks a lot!!!
Cleared my concept, thanks brother
I am unable to dry run the following two lines of code
inv_count += _mergeSort(arr, temp, left, mid);
inv_count += _mergeSort(arr, temp, mid + 1, right);
in _mergesort. Pls help
share the full code then only we can
answer
Thank you so much for the video!
If I want to print the elements in inversion, then what will be the time complexity.....
n^2
It will be nlogn
@@Santosh-om7qk You need to improve your skills
nice
thamk you helped me alot
4:14 how to get number of inversions ✔✔✅✅
4:58 examples
I came after seeing today gfg potd question :)
number of likes represent the number of times I fell asleep watching this
nice vid
This is CLRS problem 2-4
It doesnt clear all test Cases
Worst explanation I have ever seen of an algorithm and just reading the lines of code no dry run how can a beginer understand without doing a dry run
It bothers me that he starts talking about mid as if we're supposed to know what mid is.
For a more thorough description, I recommend consulting Kleinberg and Tardos: Algorithm Design (the PDF is one of the first results on Google). The relevant text is Chapter 5 - Divide and Conquer, and the section is 5.3 - Counting Inversions. This video helped me understand that section, but I wouldn't have been able to figure it out without both the text and the video.
Why is he whispering? So annoying
boring