Algorithms Tutorial

Searching Algorithms

Dynamic Programming

Graph Algorithms

Backtracking Algorithms


Operating System Algorithms

Miscellaneous Topics

Divide and Conquer Paradigm (What it is, Its Applications, Pros and Cons)

In this article, we are going to learn the concept of divide and conquer programming paradigm and its algorithms along with its applications.
Submitted by Deepak Dutt Mishra, on June 30, 2018

In the branch of Computer Science and Engineering, Information Technology and all the associated branches among these fields the term "Divide and Conquer" is an algorithm design paradigm based on the principle of recursion ( multi-branched). In this algorithmic approach, the algorithm designed works recursively by breaking down the problem in hand, into two or more sub-problems or parts based on the complexity of the problem. This sub-problems or parts are also called atomic or fractions. This atomics or fractions are recursively broken down into more and more atomic or fractions until they are broken down into a form that can be solved. After solving these fractions or atomics they are then again traversed back recursively but this time instead of breaking down the problem, the problems are merged back with their recursively broken counterparts then the required solution for that particular problem is generated.

Divide and Conquer Approach is divided into three processes and these three processes form the basis of divide and conquer paradigm for problem-solving:

1) Divide

The first and foremost process for solving any problem using Divide and Conquer paradigm. As suggested by the name it’s function is just to divide the problem into sub-problem which in turn if are more complex then are again divided into more sub-parts. Basically , if we consider for example binary search ( an example of Divide and Conquer approach ) the given list is broken ( under some specified consider defined by its algorithm and user input ) into single elements among which then the element to search is compared and the user gets a prompt whether the element is in the list.

2) Conquer

This process is referred to as ‘ Conquer ’ because this process is what which performs the basic operation of a defined algorithm like sort in cases of various sorts, finds the element to be searched in case of binary search, multiplying of the numbers in Karatsuba Algorithm and etc. But almost among algorithms at least the most basic ones that we study mostly are considered to be solved in this part since the divide part breaks them into single elements which can be simply solved.

3) Merge

This is the last process of the 'Divide' and 'Conquer' approach whose function is to recursively rebuild the original problem but what we get now is the solution to that problem. In merge procedure, the solved elements of the ‘ Conquer ‘ are recursively merged together like the way they divided in the first step i.e. ‘ Divide’.

Divide and Conquer Paradigm

The steps 'Conquer' and 'Merge' work so close that sometimes they are treated as a single step. The Divide and Conquer can be implemented in two ways:

  1. Naturally i.e. by using recursion
  2. Explicitly i.e. by using data structures like stack and queues etc

One of the major characteristics of Divide and Conquer is that the time complexity of its algorithms can be easily calculated by solving recurrence relations and its correctness can be evaluated via Mathematical Induction.

Applications of Divide and Conquer Strategy

  1. Binary Search (C program for binary search)
  2. Merge Sort (Merge sort | C++ Example)
  3. Quick Sort (Quick sort | C++ Example)
  4. Closest Pair of Points
  5. Strassen’s Multiplication
  6. Karatsuba Algorithm
  7. Cooley-Tukey Algorithm

Pros of Divide and Conquer Strategy

  1. Solves difficult problems with ease.
  2. Algorithms designed with Divide and Conquer strategies are efficient when compared to its counterpart Brute-Force approach for e.g. if we compare time complexity of simple matrix multiplication i.e. O(n3) and that of Strassen's matrix multiplication i.e. O(n2.81).
  3. Algorithms designed under Divide and Conquer strategy does not require any modification as they inhibit parallelism and can easily be processed by parallel processing systems.
  4. It makes efficient use of memory cache this happens so because that problems when divided gets so small that they can be easily solved in the cache itself.
  5. If we use floating numbers then the results may improve since round off control is very efficient in such algorithms.

Cons of Divide and Conquer Strategy

  1. Divide and Conquer strategy uses recursion that makes it a little slower and if a little error occurs in the code the program may enter into an infinite loop.
  2. Usage of explicit stacks may make use of extra space.
  3. If performing a recursion for no. times greater than the stack in the CPU than the system may crash.
  4. Choosing base cases is also a limitation as picking small cases may work if the cases are taken much higher than the capacity of the system than problems may occur.
  5. Sometimes a case where the problem when broken down results in same subproblems which may needlessly increase the solving time and extra space may be consumed.

Related Tutorials

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.