Divide_and_conquer

Divide_and_conquer - Divide & Conquer Introduction: It...

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

View Full Document Right Arrow Icon
Abdelghani Bellaachia, Algorithms - 1 - Divide Conquer ˜ Introduction: It is primarily a recursive method. The divide-and-conquer strategy consists: ü in breaking a problem into simpler subproblems of the same type, ü next to solve these subproblems, ü and finally to merge the obtained results into a solution to the problem. ˜ General approach: Procedure or function div_conq Begin If the input is small then solve directly and return; else begin Split the input into 2 or more parts. Solve the problem for those smaller parts. Combine the solutions and return; end; end;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Abdelghani Bellaachia, Algorithms - 2 - ˜ Time complexity: i s : size of the small input. r: number of times the input is split. n i : the size of each part. T(n)= C if n= i s T(n)= T split + T combine + T(n i ) if n i s Where ü T combine is the time to combine the solutions ü T(n i ) is the time needed by each r part, and ü T split is time to split the problem into r parts. ˜ Examples
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 09/03/2010.

Page1 / 7

Divide_and_conquer - Divide & Conquer Introduction: It...

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