# Category Archives: Searching

## Find row number of a binary matrix having maximum number of 1sSeptember 9, 2017

Given a binary matrix (containing only 0 and 1) of order n*n. All rows are sorted already, We need to find the row number with… Read More »

## Best meeting point in 2D binary arraySeptember 6, 2017

You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in a group. And the group… Read More »

## Find element in a sorted array whose frequency is greater than or equal to n/2.August 30, 2017

Given a sorted array of length n, find the number in array that appears more than or equal to n/2 times. It is given that… Read More »

## Find a triplet such that sum of two equals to third elementAugust 25, 2017

Given an array of integers you have to find three numbers such that sum of two elements equals the third element. Examples: Input : {5,… 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 »

## Check if an array contains all elements of a given rangeJuly 16, 2017

An array containing positive elements is given. ‘A’ and ‘B’ are two numbers defining a range. Write a function to check if the array contains… Read More »

## Squareroot(n)-th node in a Linked ListJuly 12, 2017

Given a Linked List, write a function that accepts the head node of the linked list as a parameter and returns the value of node… Read More »

## All unique triplets that sum up to a given valueJuly 6, 2017

Given an array and a sum value, find all possible unique triplets in that array whose sum is equal to the given sum value. If… 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 »

## Search an element in an unsorted array using minimum number of comparisonsJune 22, 2017

Given an array of n distinct integers and an element x. Search the element x in the array using minimum number of comparisons. Any sort… Read More »

## Count of only repeated element in a sorted array of consecutive elementsJune 21, 2017

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 »

## Recursive Programs to find Minimum and Maximum elements of arrayJune 18, 2017

Given an array of integers, we need to find the minimum element of that array using recursion. Examples: Input : A = {1, 4, 3,… Read More »

## Smallest Difference Triplet from Three arraysMay 7, 2017

Three arrays of same size are given. Find a triplet such that maximum – minimum in that triplet is minimum of all the triplets. A… Read More »

## Best First Search (Informed Search)May 3, 2017

Prerequisites : BFS, DFS In BFS and DFS, when we are at a node, we can consider any of the adjacent as next node. So… Read More »

## Search in an array of strings where non-empty strings are sortedApril 24, 2017

Given an array of strings. The array has both empty and non-empty strings. All non-empty strings are in sorted order. Empty strings can be present… Read More »