Inversions Let A1 : : n be an array of n distinct numbers.

Chapter 2, Problem 2-4

(choose chapter or problem)

Inversions Let A1 : : n be an array of n distinct numbers. If i Aj , then the pair .i; j / is called an inversion of A. a. List the five inversions of the array h2; 3; 8; 6; 1i. b. What array with elements from the set f1; 2; : : : ; ng has the most inversions? How many does it have? c. What is the relationship between the running time of insertion sort and the number of inversions in the input array? Justify your answer. d. Give an algorithm that determines the number of inversions in any permutation on n elements in .n lg n/ worst-case time. (Hint: Modify merge sort.)

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back