1.

Any algorithm that sorts by exchanging adjacent elements require O(N^2) on average.(a) True(b) FalseThis question was posed to me during an interview.My doubt stems from Insertion sort topic in portion Sorting of Data Structures & Algorithms II

Answer»

Correct ANSWER is (a) True

To explain: Each swap removes only ONE inversion, so O(N^2) swaps are REQUIRED.



Discussion

No Comment Found

Related InterviewSolutions