# Category Archives: Divide and Conquer

## Iterative Fast Fourier Transformation for polynomial multiplication

Given two polynomials, A(x) and B(x), find the product C(x) = A(x)*B(x). In the previous post we discussed the recursive approach to solve this problem… Read More »

## Fast Fourier Transformation for poynomial multiplication

Given two polynomial A(x) and B(x), find the product C(x) = A(x)*B(x). There is already an O() naive approach to solve this problem. here. This… Read More »

## The painter’s partition problem | Set 2

We have to paint n boards of length {A1, A2, .. An}. There are k painters available and each takes 1 unit time to paint… Read More »

## Find closest number in array

Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers.… Read More »

## Number of days after which tank will become empty

Given a tank with capacity C liters which is completely filled in starting. Everyday tank is filled with l liters of water and in the… Read More »

## Shuffle 2n integers in format {a1, b1, a2, b2, a3, b3, ……, an, bn} without using extra space

Given an array of 2n elements in the following format { a1, a2, a3, a4, ….., an, b1, b2, b3, b4, …., bn }. The… Read More »

## Find index of an extra element present in one sorted array

Given two sorted arrays. There is only 1 difference between the arrays. First array has one element extra added in between. Find the index of… Read More »

## Convex Hull (Simple Divide and Conquer Algorithm)

Convex hull is the smallest convex polygon containing all the given points. Input is an array of points specified by their x and y coordinates.… Read More »

## K-th Element of Two Sorted Arrays

Given two sorted arrays of size m and n respectively, you are tasked with finding the element that would be at the k’th position of… Read More »

## Collect all coins in minimum number of steps

Given many stacks of coins which are arranged adjacently. We need to collect all these coins in the minimum number of steps where in one… Read More »

## Find a peak element in a 2D array

An element is a peak element if it is greater than or equal to its four neighbors, left, right, top and bottom. For example neighbors… Read More »

## Search element in a sorted matrix

Given a sorted matrix mat[n][m] and an element ‘x’. Find position of x in the matrix if it is present, else print -1. Matrix is… Read More »

## Quickhull Algorithm for Convex Hull

Given a set of points, a Convex hull is the smallest convex polygon containing all the given points. Input is an array of points specified… Read More »

## Place k elements such that minimum distance is maximized

Given an array representing n positions along a straight line. Find k (where k

## Allocate minimum number of pages

Given number of pages in n different books and m students. The books are arranged in ascending order of number of pages. Every student is… Read More »