{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Divide_and_conquer

Divide_and_conquer - Divide Conquer Introduction It is...

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

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;

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

View Full Document
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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

Divide_and_conquer - Divide Conquer Introduction It is...

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

View Full Document
Ask a homework question - tutors are online