Divide and Conquer Problems in C/C++
The following is the list of C/C++ programs based on the level of difficulty:
Easy
- Find a Fixed Point (Value Equal To Index) in a Given Array
- Count Number of Occurrences (Or Frequency) in a Sorted Array
- Find the Maximum Element in an Array Which is First Increasing and then Decreasing
- Find a Peak Element Which is Not Smaller than its Neighbours
- Karatsuba Algorithm for Fast Multiplication Using Divide and Conquer Algorithm
- Write Program to Calculate Pow(x, N)
- Maximum and Minimum of an Array Using Minimum Number of Comparisons
- Find the Minimum Element in a Sorted and Rotated Array
- Find the Element that Appears Once in a Sorted Array
- Sequences of Given Length Where Every Element is More Than or Equal to Twice of Previous
Medium
- Median of Two Sorted Arrays of Same Size
- Quicksort
- Merge Sort Algorithm
- Check for Majority Element in a Sorted Array
- Inversion Count in Array Using Merge Sort
- Maximum Subarray Sum Using Divide and Conquer Algorithm
- K-th Element of Two Sorted Arrays
- Count All Possible Walks from a Source to a Destination with Exactly K Edges
- Unbounded Binary Search Example (Find the Point Where a Monotonically Increasing Function Becomes Positive First Time)
- Divide and Conquer | Set 5 (Strassen’s Matrix Multiplication)
Hard
- Closest Pair of Points | O(nlogn) Implementation
- Median of Two Sorted Arrays of Different Sizes
- Largest Rectangular Area in a Histogram Using Segment Tree
- Allocate Minimum Number of Pages
- The Painter’s Partition Problem Using Binary Search
- Check if aString is a Scrambled Form of Another String
- Convex Hull Using Divide and Conquer Algorithm
- Merge K Sorted Arrays | Set 3 ( Using Divide and Conquer Approach )
- The Skyline Problem Using Divide and Conquer Algorithm
- Tiling Problem Using Divide and Conquer Algorithm
C/C++ Divide and Conquer Programs
The divide and conquer is an algorithmic approach to solve problems by dividing them into smaller sub-problems, solving them, and then constructing the complete solution using the solution of smaller sub-problems. This approach uses the recursion to divide the problem into smaller subproblems and it can only be used in those problems where the smaller subproblems are of the same type.
In this article, we will discuss some top practice problems in C/C++ that use the divide-and-conquer approach.
Prerequisite: Introduction to Divide and Conquer Algorithm