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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
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 Doesnt 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

This note was uploaded on 08/06/2008 for the course IE 170 taught by Professor Ralphs during the Spring '07 term at Lehigh University .

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 Right Arrow Icon
Ask a homework question - tutors are online