Another Algorithm Job-Interview

后端 未结 5 1514
孤城傲影
孤城傲影 2021-02-04 15:02

So here is the question:

Suppose you have 100 thousand integers which ranges from 1 to 1 million. Please sort out the integers. The time complexity should

5条回答
  •  无人及你
    2021-02-04 16:03

    Use count sort. Just count all of them ( O(n) ), and then create fill the result array ( O(n), again).

提交回复
热议问题