1.

How many inversions does a sorted array have?(a) 0(b) 1(c) 2(d) cannot be determinedI need to ask this question from Arrays Types in chapter Arrays Types of Data Structures & Algorithms IThis question was posed to me in an interview for job.

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



Discussion

No Comment Found

Related InterviewSolutions