Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
Define an inversion in the context of rankings.
Think about pairs of items in terms of order.
What is the time complexity of counting inversions using the brute-force method?
Consider the number of comparisons you need for each item.
What is the time complexity of counting inversions using merge sort?
Think about how merging elements affects overall performance.
True or False: Every pair of rankings with no inversions are identical.
Reflect on the definition of inversion.
Design an algorithm that counts inversions in O(n log n) time and identify its key components.
Focus on how merging sorted lists relates to counting inversions.
Given two users' ranking lists, A = [3, 1, 2, 5, 4] and B = [2, 1, 3, 5, 4], find the number of inversions between them.
Consider how to map one ranking into the order of another.
5 more questions in this section. Enroll free to practise them all.
Enroll free