Question: 6 ) For the sequence 8 , 9 , 5 , 7 , 0 , 2 , 3 , 1 , 6 , 4 ,

6) For the sequence 8,9,5,7,0,2,3,1,6,4,40 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 9 and the 1 in the sequence?
(This is the new sequence 8,1,5,7,0,2,3,9,6,4)?
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 >=2, so give me the
answer in terms of N).(Suggestion: 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!