MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 36, Monday, December 1.

Slides:



Advertisements
Similar presentations
Back to Sorting – More efficient sorting algorithms.
Advertisements

Linear-time Median Def: Median of elements A=a 1, a 2, …, a n is the (n/2)-th smallest element in A. How to find median? sort the elements, output the.
A simple example finding the maximum of a set S of n numbers.
More on Divide and Conquer. The divide-and-conquer design paradigm 1. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving.
Divide and Conquer The most well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances.
September 12, Algorithms and Data Structures Lecture III Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Divide-and-Conquer Recursive in structure –Divide the problem into several smaller sub-problems that are similar to the original but smaller in size –Conquer.
CSC 331: Algorithm Analysis Divide-and-Conquer Algorithms.
Chapter 4: Divide and Conquer Master Theorem, Mergesort, Quicksort, Binary Search, Binary Trees The Design and Analysis of Algorithms.
1 Divide-and-Conquer CSC401 – Analysis of Algorithms Lecture Notes 11 Divide-and-Conquer Objectives: Introduce the Divide-and-conquer paradigm Review the.
Week #10 – 28/30 October and 1 November 2002 Prof. Marie desJardins
Introduction to Algorithms 6.046J/18.401J L ECTURE 3 Divide and Conquer Binary search Powering a number Fibonacci numbers Matrix multiplication Strassen’s.
CS223 Advanced Data Structures and Algorithms 1 Divide and Conquer Neil Tang 4/15/2010.
Lecture 5COMPSCI.220.FS.T Worst-Case Performance Upper bounds : simple to obtain Lower bounds : a difficult matter... Worst case data may be unlikely.
CS 2210 (22C:19) Discrete Structures Advanced Counting
8/29/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Spring 2006 Convex Hulls Carola Wenk.
Lecture 8 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 19, Friday, October 17.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Chapter 4: Divide and Conquer The Design and Analysis of Algorithms.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 22, Friday, October 24.
Lecture 2: Divide and Conquer I: Merge-Sort and Master Theorem Shang-Hua Teng.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 27, Wednesday, November 5.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 16, Monday, October 6.
Functional Design and Programming Lecture 4: Sorting.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 39, Monday, December 8.
1 Solutions to Recurrences Supplementary Notes Prepared by Raymond Wong Presented by Raymond Wong.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 11, Wednesday, September 24.
CSC 2300 Data Structures & Algorithms January 30, 2007 Chapter 2. Algorithm Analysis.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 34, Friday, November 21.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 21, Wednesday, October 22.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions Analysis of.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 38, Friday, December 5.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 10, Monday, September 22.
MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 20, Monday, October 20.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions BIL741: Advanced.
October 1, Algorithms and Data Structures Lecture III Simonas Šaltenis Nykredit Center for Database Research Aalborg University
Turn in your Quiz!!! Complete the following:. Section 11-5: Common Logarithms The questions are… What is a common log? How do I evaluate common logs?
Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 3 Prof. Erik Demaine.
Recurrence Relation. Outline  What is a recurrence relation ?  Solving linear recurrence relations  Divide-and-conquer algorithms and recurrence relations.
Warm-Up 5/3/13 Homework: Review (due Mon) HW 3.3A #1-15 odds (due Tues) Find the zeros and tell if the graph touches or crosses the x-axis. Tell.
DR. NAVEED AHMAD DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF PESHAWAR LECTURE-5 Advance Algorithm Analysis.
1 Chapter 4 Divide-and-Conquer. 2 About this lecture Recall the divide-and-conquer paradigm, which we used for merge sort: – Divide the problem into a.
Algorithmic Analysis Charl du Plessis and Robert Ketteringham.
Divide-and-Conquer. Outline Introduction Merge Sort Quick Sort Closest pair of points Large integer multiplication.
7.2 Solving Linear Recurrence Relations Some of these recurrence relations can be solved using iteration or some other ad hoc technique. However, one important.
Midterm Review 1. Midterm Exam Thursday, October 15 in classroom 75 minutes Exam structure: –TRUE/FALSE questions –short questions on the topics discussed.
1 Ch.19 Divide and Conquer. 2 BIRD’S-EYE VIEW Divide and conquer algorithms Decompose a problem instance into several smaller independent instances May.
 Design and Analysis of Algorithms تصميم وتحليل الخوارزميات (311 عال) Chapter 2 Sorting (insertion Sort, Merge Sort)
A Introduction to Computing II Lecture 7: Sorting 1 Fall Session 2000.
Lecture 6 Sorting II Divide-and-Conquer Algorithms.
Introduction to Algorithms: Divide-n-Conquer Algorithms
Modeling with Recurrence Relations
UNIT- I Problem solving and Algorithmic Analysis
Unit 1. Sorting and Divide and Conquer
Theorem Let an = can/k + f(n) be recurrence relation with positive constant c and the positive function f(n). (a) If for large n, f(n) grows proportional.
Lecture 4 Divide-and-Conquer
Chapter 4 Divide-and-Conquer
Divide and Conquer.
Algorithms and Data Structures Lecture III
CSE 2010: Algorithms and Data Structures
Introduction to Algorithms
Divide and Conquer Algorithms Part I
Solving Recurrence Relations
Trevor Brown CS 341: Algorithms Trevor Brown
Algorithms and Data Structures Lecture III
Presentation transcript:

MATH 310, FALL 2003 (Combinatorial Problem Solving) Lecture 36, Monday, December 1

7.2. Divide-and-Conquer Relations Homework (MATH 310#11M): Read 7.2,7.3 Do 7.1,7.2: all odd numbered problems Turn in 7.2: 2,4,6,8

Divide-and-Conquer Divide the problem in two smaller parts, solve each subproblem nad combine solutions. a n = ca n/2 + f(n).

Divide-and-Conquer Divide the problem in two smaller parts, solve each subproblem nad combine solutions. a n = ca n/2 + f(n). cf(n)anan 1dd d log 2 n e + A 2dAn – d >2dnan log2c + (2d/(2-c)) n 2dndn( d log 2 n e + A)

Example 1: Rounds in a Tournament Number of rounds in a tennis tournament. Number of players: n = 2 k, for some k. a n = a n/ a n = log 2 n + A. Observe that a 1 = 0, and so A = 0. On the left: n = 8, a 8 = 3.

Example 2: Finding the Largest and the Smallest Element in a Set a n = 2a n/2 + 2 a 2 = 1 a n = (3/2)n – 2. m,M m 1,M 1 m 2,M 2 m = min{m 1,m 2 } M = max{M 1,M 2 }

Example 3: Efficient Multidigit Multiplication g = [g 1,g 2 ] = g 1 £ 10 n/2 + g 2. h = [h 1,h 2 ] = h 1 £ 10 n/2 + h 2. g £ h = (g 1 £ h 1 ) £ 10 n + (g 1 £ h 2 + g 2 £ h 1 ) £ 10 n/2 +(g 2 £ h 2 ). We need only (g 1 £ h 1 ), (g 2 £ h 2 ) and (g 1 + g 2 ) £ (h 1 + h 2 ). a n = 3a n/2. a n = n log2 3 = n

Theorem Let a n = ca n/k + f(n) be recurrence relation with positive constant c and the positive function f(n). (a) If for large n, f(n) grows proportional to n logk c, then a n grows proportional to n logk c log 2 c. (b) If for large n f(n) · pn q, where p is a positive constant and q < logk c, then a n grows at most at rate proportional to n logk c.