Chapter 0: Q20E (page 11)
Show that any array of integers can be sorted in O (n + M) time, where
role="math" localid="1659938331794"
For small M, this is linear time: why doesn’t the lower bound apply in this case?
Show that any array of integers can be sorted in O (n + M) time, where
role="math" localid="1659938331794"
For small M, this is linear time: why doesn’t the lower bound apply in this case?
Short Answer
The lower bound does not apply because this is not a comparison-based sort, and also because the information beforehand about the range of the elements in the array is given.