1.

What is the average time complexity of pigeonhole sort (k=range of input)?(a) O(n)(b) O(n+k)(c) O(n^2)(d) O(n*k)The question was asked in examination.Asked question is from Sorting topic in portion Sorting of Data Structures & Algorithms II

Answer»

The CORRECT answer is (b) O(N+k)

The explanation is: Time COMPLEXITY of pigeonhole sort is O(n+k). It has two loops. ONE of the loops runs from 0 to range(k) and the other one runs from 0 to n so the time complexity becomes O(n+k).



Discussion

No Comment Found

Related InterviewSolutions