# M11 - Lecture C11 Response to'Muddiest Part of the Lecture Cards(9 respondents 1 It seems like merge sort is a very poor algorithm Once you break

This preview shows pages 1–2. Sign up to view the full content.

Lecture C11 Response to 'Muddiest Part of the Lecture Cards' (9 respondents) 1) It seems like merge sort is a very poor algorithm. Once you break it down to length-2 strings, they must often still be split to put other elements from say a different string in. Why not just pop them all to memory and insertion sort ? I am not really sure how you came to this conclusion. If you analyze the two algorithms you will see that merge sort has a lower upper bound ( n*log 2 n) than the upper bound for insertion sort ( n 2 ) . The basic idea for Insertion sort is to scan the array from the beginning to the end. Insert the current element into its proper position (which is found using a search algorithm). The running time of Insertion Sort is Best case : Array is already sorted Using linear search Æ O(n) Using binary search Æ O(n log n) Worst case : Array is already sorted, but in reverse order Using linear search Æ O(n 2 ) Using binary search Æ O(n 2 ) Average case is same as worst case Merge sort is a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/28/2012 for the course AERO 16.01 taught by Professor Markdrela during the Fall '05 term at MIT.

### Page1 / 3

M11 - Lecture C11 Response to'Muddiest Part of the Lecture Cards(9 respondents 1 It seems like merge sort is a very poor algorithm Once you break

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online