##
QuickSort
January 7, 2014

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.

January 7, 2014

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.

November 28, 2013

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 »

July 2, 2013

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

June 19, 2013

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

May 18, 2013

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 »

April 18, 2013

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 »

April 8, 2013

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 »

March 16, 2013

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 »

March 15, 2013

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 »

November 28, 2012

November 15, 2012

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.

September 28, 2012

This is an extension of median of two sorted arrays of equal size problem. Here we handle arrays of unequal size also.

January 14, 2012

Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array.

December 1, 2011

Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is… Read More »

May 3, 2011

Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. Expected time complexity is O(Logn)