{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec11

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

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

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 .

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

View Full Document
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 oﬃcially 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
Lecture 11 Sorting IV: Stable Sorting, Radix Sort 6.006 Spring 2008 3. Gather

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.

{[ snackBarMessage ]}