## Divide and Conquer | Set 6 (Search in a Row-wise and Column-wise Sorted 2D Array)

Given an n x n matrix, where every row and column is sorted in increasing order. Given a key, how to decide whether this key… Read More »

Given an n x n matrix, where every row and column is sorted in increasing order. Given a key, how to decide whether this key… Read More »

Given an array of 1s and 0s which has all 1s first followed by all 0s. Find the number of 0s. Count the number of… Read More »

Given two square matrices A and B of size n x n each, find their multiplication matrix.

Given a sorted array arr[] of n elements, write a function to search a given element x in arr[].

Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot.

We are given an array of n points in the plane, and the problem is to find out the closest pair of points in the… Read More »

A sorted array is rotated at some unknown point, find the minimum element in it. Following solution assumes that all elements are distinct.

Given a function ‘int f(unsigned int x)’ which takes a non-negative integer ‘x’ as input and returns an integer as output.

Given an array of integers. Find a peak element in it. An array element is peak if it is NOT smaller than its neighbors. For… Read More »

Given two binary strings that represent value of two integers, find the product of two strings. For example, if the first bit string is “1100”… Read More »

Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity,… Read More »

You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has… Read More »

Like QuickSort, Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then… Read More »

Like Greedy and Dynamic Programming, Divide and Conquer is an algorithmic paradigm. A typical Divide and Conquer algorithm solves a problem using following three steps.