{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec11 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Background image of page 1

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

View Full Document Right Arrow Icon
Lecture 11 Sorting IV: Stable Sorting, Radix Sort 6.006 Spring 2008 Lecture 11: Sorting IV: Stable Sorting, Radix Sort Lecture Overview Stable Sorting Radix Sort Quick Sort not officially a part of 6 . 006 Sorting Races Stable Sorting Preserves input order among equal elements 3 * 1 4’ counting sort is stable 4 1 4’ 3 * 4 3 3 merge sort is stable Figure 1: Stability Selection Sort and Heap: Find maximum element and put it at end of array (swap with element at end of array) NOT STABLE! 3 2 a 2 b 2 b 2 a 3 define 2 a <2 b Figure 2: Selection Sort Instability Radix Sort Herman Hollerith card-sorting machine for 1890 census. Digit by Digit sort by mechanical machine 1. Examine given column of each card in a deck 2. Distribute the card into one of 10 bins 1
Background image of page 2
Lecture 11 Sorting IV: Stable Sorting, Radix Sort 6.006 Spring 2008 3. Gather
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}