{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture6

# lecture6 - Divide-And-Conquer Recurrences and Recursion...

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

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.

Unformatted text preview: Divide-And-Conquer Recurrences and Recursion IE170: Algorithms in Systems Engineering: Lecture 6 Jeff Linderoth Department of Industrial and Systems Engineering Lehigh University January 26, 2007 Jeff Linderoth IE170:Lecture 6 Divide-And-Conquer Recurrences and Recursion Towers of Hanoi Merge Sort Taking Stock Last Time Divide-and-Conquer The Master-Theorem When the World Will End This Time Master Theorem Practice Some Sorting Algs. Data Structures Jeff Linderoth IE170:Lecture 6 Divide-And-Conquer Recurrences and Recursion Towers of Hanoi Merge Sort The Master Theorem If recurrence has the form T ( n ) = Θ(1) n = 1 aT ( n/b ) + f ( n ) n > 1 The Master Theorem tells us how to analyze it: If f ∈ O ( n log b a- ε ) , for some constant ε > , then T ∈ Θ( n log b a ) . If f ∈ Θ( n log b a ) , then T ∈ Θ( n log b a lg n ) . If f ∈ Ω( n log b a + ε ) , for some constant ε > , and if af ( n/b ) ≤ cf ( n ) for some constant c < 1 and n > n , then T ∈ Θ( f ) . Jeff Linderoth IE170:Lecture 6 Divide-And-Conquer Recurrences and Recursion Towers of Hanoi Merge Sort Some More Examples... Here we will do a couple examples of the master theorem Also I will show you a little trick (substitution) that can come in handy – especially if you have √ · Not Fun! Homework 2.2-1: and prove that it has that form. Do all of 4.1 Jeff Linderoth IE170:Lecture 6 Divide-And-Conquer Recurrences and Recursion Towers of Hanoi Merge Sort Fun! Simple Sorting Algorithms: Merge Sort: Divide the list into smaller pieces. Sort the small pieces. Then merge together sorted lists. Insertion Sort: Insert item j into A [0 ...j- 1] Selection Sort Find j th smallest element and put it in A [ j ] Bubble sort: Start at end of array: If A [ j ] < A [ j- 1] , swap them Jeff Linderoth IE170:Lecture 6 Divide-And-Conquer Recurrences and Recursion Master Theorem Master Theorem Doesn’t Always Work! The Java Collections Interfaces In the remainder of the class, we will be using the Java Collections Interface: http://java.sun.com/docs/books/ tutorial/collections/TOC.html Important: Most of what I will say only works if you set the “code level” to Java 5.0 in eclipse!...
View Full Document

{[ snackBarMessage ]}

### Page1 / 5

lecture6 - Divide-And-Conquer Recurrences and Recursion...

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

View Full Document
Ask a homework question - tutors are online