Divide and Conquer

  • Last Updated : 08 May, 2023

Learn more about Divide and Conquer Algorithms in DSA Self Paced Course
Practice Problems on Divide and Conquer

Some Quizzes on Divide and Conquer

What is Divide and Conquer?

Divide and Conquer is an algorithmic paradigm in which the problem is solved using the Divide, Conquer, and Combine strategy.

A typical Divide and Conquer algorithm solves a problem using following three steps:

  1. Divide: This involves dividing the problem into smaller sub-problems.
  2. Conquer: Solve sub-problems by calling recursively until solved.
  3. Combine: Combine the sub-problems to get the final solution of the whole problem.

Standard algorithms that follow Divide and Conquer algorithm

The following are some standard algorithms that follow Divide and Conquer algorithm.  

  1. Quicksort is a sorting algorithm. The algorithm picks a pivot element and rearranges the array elements so that all elements smaller than the picked pivot element move to the left side of the pivot, and all greater elements move to the right side. Finally, the algorithm recursively sorts the subarrays on the left and right of the pivot element.
  2. Merge Sort is also a sorting algorithm. The algorithm divides the array into two halves, recursively sorts them, and finally merges the two sorted halves.
  3. Closest Pair of Points The problem is to find the closest pair of points in a set of points in the x-y plane. The problem can be solved in O(n^2) time by calculating the distances of every pair of points and comparing the distances to find the minimum. The Divide and Conquer algorithm solves the problem in O(N log N) time.
  4. Strassen’s Algorithm is an efficient algorithm to multiply two matrices. A simple method to multiply two matrices needs 3 nested loops and is O(n^3). Strassen’s algorithm multiplies two matrices in O(n^2.8974) time.
  5. Cooley–Tukey Fast Fourier Transform (FFT) algorithm is the most common algorithm for FFT. It is a divide and conquer algorithm which works in O(N log N) time.
  6. Karatsuba algorithm for fast multiplication does the multiplication of two n-digit numbers in at most 3n^{log_{2}^{3}}\approx 3n^{1.585} single-digit multiplications in general (and exactly n^{\log_23}        when n is a power of 2). It is, therefore, faster than the classical algorithm, which requires n2 single-digit products. If n = 210 = 1024, in particular, the exact counts are 310 = 59, 049 and (210)2 = 1, 048, 576, respectively.

Example of Divide and Conquer algorithm

A classic example of Divide and Conquer is Merge Sort demonstrated below. In Merge Sort, we divide array into two halves, sort the two halves recursively, and then merge the sorted halves.


  1. Intoduction to Divide and Conquer
  2. Dynamic Programming vs Divide-and-Conquer
  3. Decrease and Conquer
  4. Advanced master theorem for divide and conquer recurrences

Some Standard algorithms:

  1. Binary Search
  2. Merge Sort
  3. Quick Sort
  4. Calculate pow(x, n)
  5. Karatsuba algorithm for fast multiplication
  6. Strassen’s Matrix Multiplication
  7. Convex Hull (Simple Divide and Conquer Algorithm)
  8. Quickhull Algorithm for Convex Hull

Binary Search based problems:

  1. Find a peak element in a given array
  2. Check for Majority Element in a sorted array
  3. K-th Element of Two Sorted Arrays
  4. Find the number of zeroes
  5. Find the Rotation Count in Rotated Sorted array
  6. Find the point where a monotonically increasing function becomes positive first time
  7. Median of two sorted arrays
  8. Median of two sorted arrays of different sizes
  9. The painter’s partition problem using Binary Search

Some other Practic problems:

  1. Square root of an integer
  2. Maximum and minimum of an array using minimum number of comparisons
  3. Find frequency of each element in a limited range array in less than O(n) time
  4. Tiling Problem
  5. Count Inversions
  6. The Skyline Problem
  7. Search in a Row-wise and Column-wise Sorted 2D Array
  8. Allocate minimum number of pages
  9. Modular Exponentiation (Power in Modular Arithmetic)

Quick Links :

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up