For inputs of size n, for which values of n does insertion-sort beat merge-sort? [closed]

风格不统一 提交于 2019-11-30 09:01:10

Since you are to find when insertion sort beats merge sort

8n^2<=64nlogn
n^2<=8nlogn
n<=8logn

On solving n-8logn = 0 you get

n = 43.411

So for n<=43 insertion sort works better than merge sort.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!