Insertion sort beats merge sort when 8n2 < 64n lg n, ) n < 8 lg n, ) 2n=8 < n. This is true for
2 <= n <= 43 (found by using a calculator).
Rewrite merge sort to use insertion sort for input of size 43 or less in order to improve the
running time.
No comments:
Post a Comment