# Tag Archives: Binary-Search

## Find maximum sum of triplets in an array such than i < j < k and a[i] < a[j] < a[k]October 7, 2017

Given an array of positive integers of size n. Find the maximum sum of triplet( ai + aj + ak ) such that 0 <=… Read More »

## Find the index of first 1 in an infinite sorted array of 0s and 1sSeptember 11, 2017

Given an infinite sorted array consisting 0s and 1s. The problem is to find the index of first ‘1’ in that array. As the array… Read More »

## Repeatedly search an element by doubling it after every successful searchAugust 24, 2017

Given an array “a[]” and integer “b”. Find whether b is present in a[] or not. If present, then double the value of b and… Read More »

## Number of days after which tank will become emptyAugust 20, 2017

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 »

## Minimize cost of operation to equalize tower heightsAugust 13, 2017

Given heights of n (n <=10000) towers as an array h[]; we need to bring every tower to same height by either adding or removing… Read More »

## Longest Bitonic Subsequence in O(n log n)August 1, 2017

Given an array arr[0 … n-1] containing n positive integers, a subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Write… Read More »

## Find an element in Bitonic arrayJuly 15, 2017

Given a bitonic sequence of n distinct elements, write a program to find a given element x in the bitonic sequence in O(log n) time.… Read More »

## Find median in row wise sorted matrix

We are given a row wise sorted matrix of size r*c, we need to find the median of the matrix given. It is assumed that… Read More »

## Find the index of first 1 in a sorted array of 0’s and 1’sJuly 13, 2017

Given a sorted array consisting 0’s and 1’s. The problem is to find the index of first ‘1’ in the sorted array. It could be… Read More »

## Queries for counts of array elements with values in given rangeJuly 12, 2017

Given an unsorted array of size n, find no of elements between two elements i and j (both inclusive). Examples: Input : arr = [1… Read More »

## Count quadruples from four sorted arrays whose sum is equal to a given value xJuly 4, 2017

Given four sorted arrays each of size n of distinct elements. Given a value x. The problem is to count all quadruples(group of four numbers)… Read More »

## Check whether a given array is a k sorted array or notJune 21, 2017

Given an array of n distinct elements. Check whether the given array is a k sorted array or not. A k sorted array is an… Read More »

## Count of only repeated element in a sorted array of consecutive elements

Given a sorted array of consecutive elements. The array has only one element repeated many times. The task is to find length of the sequence… Read More »

## Find minimum value to assign all array elements so that array product becomes greater

Given an array arr[] of n elements, update all elements of given array to some minimum value x i.e, arr[i] = x (0 4 *… Read More »

## Find the transition point in a binary arrayJune 17, 2017

Given a sorted array containing only numbers 0 and 1, the task is to find the transition point efficiently. Transition point is a point where… Read More »