+1 vote
in Data Structures & Algorithms I by (110k points)
How many inversions does a sorted array have?

(a) 0

(b) 1

(c) 2

(d) cannot be determined

I need to ask this question from Arrays Types in chapter Arrays Types of Data Structures & Algorithms I

This question was posed to me in an interview for job.

1 Answer

+1 vote
by (408k points)
selected by
Best answer
The correct option is (a) 0

For explanation: When an array is sorted then there cannot be any inversion in the array. As the necessary condition for an inversion is arr[i]>arr[j] and i<j.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.