Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
12.5. Graphical Representation of Inversions
This section
Practice test
11 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
4 cards from this lesson. Good the night before a test.
Try these first
- 1.
Define what an inversion is.
Hint
Think about two people's different preferences.
- 2.
What is the time complexity of a brute-force method to count inversions?
Hint
Consider how many comparisons are made.
- 3.
What is an inversion?
- A pair ranked similarly
- A ranking disagreement
- A sorting algorithm
Hint
Recall the definition we discussed.
- 4.
True or False: The brute force method is the most efficient way to count inversions.
- True
- False
Hint
Think about the performance of the two methods.
- 5.
Given the array [10, 20, 30, 40], if a new number '25' is added, how many inversions are created?
Hint
Check the new number against existing numbers to see if they form inversions.
- 6.
Using your knowledge of merge sort, detail the steps to count inversions for the array [7, 5, 6, 4].
Hint
Break down the problem and count during each merge step.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
1 more question available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting