Loading
-
601.
-
602.
-
603.
In a permutation a1 ... an, of n distinct integers, an inversion is a pair (ai, aj) such that
i < j and ai > aj.[1] If all permutations are equally likely, what is the expected number of inversions in a randomly chosen permutation of 1. . . n? [2 marks]
(a) n(n-1)/4
(b) n(n-1)/2
(c) n(n+1)/4
(d) 2n[log2n]
[2] What would be the worst case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of 1. . . n with at most n inversions? [2 marks]
(A) Θ(n2)
(B) Θ(n log n)
(C) Θ(n1.5)
(D) Θ(n)asked in Computer Science And Engineering, 2003
View Comments [0 Reply]
-
604.
-
605.
-
606.