1.

What is the best case complexity of selection sort?(a) O(nlogn)(b) O(logn)(c) O(n)(d) O(n^2)This question was addressed to me in an interview for job.Query is from Selection Sort topic in chapter Sorting of Data Structures & Algorithms II

Answer»

The CORRECT choice is (d) O(n^2)

The BEST I can explain: The best, average and worst case complexities of selection SORT is O(n^2).

(n-1) + (n-2) + (n-3) + …. + 1 = (n(n-1))/2 ~ (n^2)/2.



Discussion

No Comment Found

Related InterviewSolutions