English, asked by AlexSAMUEL60, 6 months ago

plz solve
.
find the two lines that contains inversion

give right answers​

Attachments:

Answers

Answered by hemanth4897
1

Answer:

Explanation:

Anversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum.

Formally speaking, two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j

Example:

Input: arr[] = {8, 4, 2, 1}

Output: 6

Explanation: Given array has six inversions:

(8,4), (4,2),(8,2), (8,1), (4,1), (2,1).

Input: arr[] = {3, 1, 2}

Output: 2

Explanation: Given array has two inversions

Similar questions