Lecture10

# Lecture10 - Announcements 5 Read Chapter 13 Exam returned...

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

05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 1 Announcements Announcements 5 Read: Chapter 13 Exam: returned next Tuesday in class A2 available by Monday

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

View Full Document
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 2 Last Lecture Last Lecture 5 Sorting Video Exam Review
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 3 This Lecture This Lecture 5 Faster Sorting Shell Sort Merge Sort

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

View Full Document
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 4 What if n is large? n=1000 What if n is large? n=1000 5 If n is large, n 2  is not that great.       If n=1000,  n 2  = 1000000 Can we do better? There are several algorithms that can sort in less than O(n 2 )
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 5 Shell Sort (improved insertion) Shell Sort (improved insertion) 5 What's the algorithm? for ( space=n/2; space >= 1; space=space/2 ) if (space%2==0) space = space+1; sortSubArray( data, 0, n-1, space ) F F H H E E I I C C A A G G B B D D n=9 space=9/2=4    5 sortSubArray( data, 0, 8, 5 )

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

View Full Document
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 6 Shell Sort (improved insertion) Shell Sort (improved insertion) F F H H E E I I C C A A G G B B D D  9 space   5 sortSubArray( data, 0, 8, 5 ) comp = 1                move = 0
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 7 Shell Sort (improved insertion) Shell Sort (improved insertion) F F H H E E I I C C G G B B D D  9 space   5 sortSubArray( data, 0, 8, 5 ) A A comp = 1                move = 1

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

View Full Document
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 8 Shell Sort (improved insertion) Shell Sort (improved insertion) A A H H E E I I C C F F G G B B D D  9 space   5 sortSubArray( data, 0, 8, 5 ) comp = 1                move = 1
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 9 Shell Sort (improved insertion) Shell Sort (improved insertion) A A H H E E I I C C F F G G B B D D  9 space   5 sortSubArray( data, 0, 8, 5 ) comp = 1                move = 1

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

View Full Document
05/13/09 ©2004 Deb Deppeler. Some content based on work by Susan Horwitz ©2003. Used by permission. 10
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/17/2011 for the course CS 367 taught by Professor Marvinsolomon during the Spring '08 term at University of Wisconsin.

### Page1 / 162

Lecture10 - Announcements 5 Read Chapter 13 Exam returned...

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

View Full Document
Ask a homework question - tutors are online