0% found this document useful (0 votes)
19 views7 pages

2.1 Divide and Conquer

Uploaded by

shinchankolli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views7 pages

2.1 Divide and Conquer

Uploaded by

shinchankolli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Divide and Conquer

It is a strategy that breaks the problem into several subproblems that are
similar to the original problem but smaller in size, solve the subproblems
recursively, and then combine these solutions to create a solution to the
original problem.

Fig: Divide-and-Conquer technique


Divide and Conquer
In divide-and-conquer, we solve a problem recursively, applying three
steps at each level of the recursion:
(1) Divide the problem into a number of subproblems that are
smaller instances of the same problem.
(2) Conquer the subproblems by solving them recursively. If the
subproblem sizes are small enough, however, just solve the
subproblems in a straightforward manner.
(3) Combine the solutions to the subproblems into the solution for
the original problem.
Divide and Conquer
 When the subproblems are large enough to solve recursively, we
call that the recursive case.
 Once the subproblems become small enough that we no longer
recurse, we say that the recursion “bottoms out” and that we have
gotten down to the base case.
 Sometimes, in addition to subproblems that are smaller instances of
the same problem, we have to solve subproblems that are not quite
the same as the original problem.
 We consider solving such subproblems as part of the combine step.
Control abstraction for divide-and-conquer technique
A control abstraction is a procedure whose flow of control is clear but whose
primary operations are specified by other procedures whose precise
meanings are left undefined. The control abstraction for divide and conquer
technique is given below:
Algorithm DandC(P)
{
if small(P) then
return s(P);
else
{
Divide P into smaller instances P1, P2, P3….. Pk; where k>1
Apply DandC to each of the subproblems;
return combine(DandC(P1), DandC(P2)….DandC(Pk));
}
}
Analyzing divide-and-conquer algorithms
When an algorithm contains a recursive call, we can often
describe its running time by a recurrence equation or recurrence,
which describes the overall running time on a problem of size ‘n’.
We can then use mathematical tools to solve the recurrence and
provide bounds on the performance of the algorithm.
A recurrence for the running time of a divide-and-conquer
algorithm falls out from the three steps of the basic paradigm.
Let T (n) be the running time on a problem of size n. If the problem
size is small enough, say n ≤ c for some constant c, the straightforward
solution takes constant time, which we write as Θ(1).
Suppose that our division of the problem yields ‘a’ subproblems,
each of which is ‘1/b’ the size of the original.
It takes time T (n/b) to solve one subproblem of size n/b, and so it
takes time aT(n/b) to solve ‘a’ of them.
If we take D(n) time to divide the problem into subproblems and
C(n) time to combine the solutions to the subproblems into the
solution to the original problem, we get the recurrence
Give the general idea of Divide & Conquer algorithms. [2M]
[R16-III-II Regular SET-3 April/May – 2019]

Describe the time complexity of Divide and Conquer in the recurrence


form. [2M] [R16-III-II Regular SET-2 April/May - 2019]

Write the general method of Divide – And – Conquer approach.[7M]


[R16-III-II Supplementary November – 2019]

Write the control abstraction for divide-and-conquer algorithms.[2M]


[R16-III-II Regular SET-4 April/May – 2019]

Define the Divide and Conquer Strategy. [2M]


[R16-III-II Regular/Supple Oct/Nov – 2020]

You might also like