0 0 votes Suppose we are comparing implementations of insetion sort and merge sort on the same machine. For inputs of size n, insertion sort runs in 8n^2 steps, while merge sort runs in 64nlgn steps. For which values of n does insertion sort beat merge sort? Algorithms algorithms sorting merge-sort + – spriti1991 1.3k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes I know that Insertion sort is better as compared to Merge sort only for small set of Imputs . Here if i put n=2 then i get 32 steps for merge and 128 steps . SO here only Insertion has beat Merge sort . Continuing in this manner at n =43 i would get 14792 steps and 147933.806 steps in merge . After this the whole scenario changes Merge Sort wins ! So the answer for above will be from 2 to 42 right or just 42 ? spriti1991 answered May 20, 2015 spriti1991 comment Share Follow See all 2 Comments 2 2 Comments reply Anu commented May 20, 2015 reply Follow flag At n>43 merge sort beats insertion sort.so answer will be 2 to 43 1 1 replyShare radha gogia commented Jul 22, 2015 reply Follow flag Can you please explain ur approach that is how u thought of going calculating upto 43 ,plz tell this . 1 1 replyShare Please log in or register to add a comment.