1.

What is the condition for two elements arr[i] and arr[j] to form an inversion?(a) arr[i] arr[j] and i < jThe question is from Arrays Types topic in section Arrays Types of Data Structures & Algorithms IThe question was asked in an international level competition.

Answer»

Correct choice is (d) arr[i] > arr[J] and i < j

The explanation is: For two elements to form an inversion the necessary condition is arr[i] > arr[j] and i < j. The NUMBER of inversions in an ARRAY indicate how CLOSE or far the array is from being completely sorted.



Discussion

No Comment Found

Related InterviewSolutions