Question: 6 ) For the sequence 8 , 9 , 5 , 7 , 0 , 2 , 3 , 1 , 6 , 4 ,
For the sequence pt Note: you dont have to sort this data to get the answers
An inversion is any pair that is in the wrong order. They dont have to be next to each other.
a How many inversions are there in the above sequence? List them
b How many inversions are there if you exchange the and the in the sequence?
This is the new sequence
c What is the maximum number of inversions in a reverse sorted worst case sequence of N numbers? This
question is not related to parts a and b N is a variable and can have any positive value so give me the
answer in terms of NSuggestion: Try a few sequences to see if your answer makes sense
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
