Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
Define what an inversion is.
Think about two people's different preferences.
What is the time complexity of a brute-force method to count inversions?
Consider how many comparisons are made.
What is an inversion?
Recall the definition we discussed.
True or False: The brute force method is the most efficient way to count inversions.
Think about the performance of the two methods.
Given the array [10, 20, 30, 40], if a new number '25' is added, how many inversions are created?
Check the new number against existing numbers to see if they form inversions.
Using your knowledge of merge sort, detail the steps to count inversions for the array [7, 5, 6, 4].
Break down the problem and count during each merge step.
5 more questions in this section. Enroll free to practise them all.
Enroll free