Vidyalelo
Data Structure · Q48

Arrays in Data Structures

Programming · Data Structure · question 48

Q48

What is the time complexity of the following code that determines the number of inversions in an array? int InvCount(int arr[], int n) int count = 0; for (int i = 0; i arr[j]) count++; return count;

A.
O(n)
B.
O(n log n)
C.
O(n2)
Answer
D.
O(log n)

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board