You are viewing a single comment's thread. Return to all comments →
This is a great explanation by Tim Roughgarder about this algorithm and why this formula works:
count += mid - i + 1;
Part 1: https://www.youtube.com/watch?v=4IvYaOY8Pxw
Part 2: https://www.youtube.com/watch?v=PLkuid82dbc
Seems like cookies are disabled on this browser, please enable them to open this website
Merge Sort: Counting Inversions
You are viewing a single comment's thread. Return to all comments →
This is a great explanation by Tim Roughgarder about this algorithm and why this formula works:
Part 1: https://www.youtube.com/watch?v=4IvYaOY8Pxw
Part 2: https://www.youtube.com/watch?v=PLkuid82dbc