Worse is better. Is there an example?

前端 未结 24 951
予麋鹿
予麋鹿 2020-12-12 19:03

Is there a widely-used algorithm that has time complexity worse than that of another known algorithm but it is a better choice in all practical si

24条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 19:44

    Quick-sort has worst case time complexity of O(N^2)! 
    It is considered better than other sorting algorithms 
    like mergesort heapsort etc. which have O(N log n) time complexity 
    in the worst case.
    The reason may be the 
    1.in place sorting 
    2.stability, 
    3.very less amount of code involved.
    

提交回复
热议问题