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. Divide and Conquer: Counting Inversions
This section
Practice test
10 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
2 cards from this lesson. Good the night before a test.
Try these first
- 1.
Define what an inversion is in a list.
Hint
Think about the order of elements in an array.
- 2.
What does the divide and conquer method entail?
Hint
Remember the steps of the algorithm.
- 3.
What is an inversion in a sequence?
- A pair of items that are in sequential order
- A pair of items that are not in sequential order
- Any two items in a sequence
Hint
Think about how we define ordering in a list.
- 4.
True or False: A divide and conquer strategy can be used to count inversions efficiently.
- True
- False
Hint
Recall the efficiency compared to a brute force method.
- 5.
Determine the number of inversions for the following array: [2, 3, 8, 6, 1]. Explain the process you used.
Hint
List pairs in order and check their indices.
- 6.
Consider two rankings, A = [3, 1, 2] and B = [1, 3, 2]. Calculate the number of inversions and describe how you derived the count.
Hint
Focus on how elements are ranked in both A and B.
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
Get your answers marked and your progress tracked
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