Skip to content

Tag Archives: Binary Search

You are given a bitonic sequence, the task is to find Bitonic Point in it. A Bitonic Sequence is a sequence of numbers which is… Read More
Given hypotenuse and area of a right angle triangle, get its base and height and if any triangle with given hypotenuse and area is not… Read More
Given a sorted array of n elements containing elements in range from 1 to n-1 i.e. one element occurs twice, the task is to find… Read More
Given an array of limits. For every limit, find the prime number which can be written as the sum of the most consecutive primes smaller… Read More
Arrays.binarySearch() method searches the specified array of the given data type for the specified value using the binary search algorithm. The array must be sorted… Read More
You are given a number n ( 3 <= n < 10^6 ) and you have to find nearest prime less than n? Examples:  Input… Read More
java.util.Collections.binarySearch() method is a java.util.Collections class method that returns position of an object in a sorted list.  // Returns index of key in sorted list… Read More
  Prerequisite: Linear Search Binary Search LINEAR SEARCH Assume that item is in an array in random order and we have to find an item.… Read More
Given a sorted array and a value x, the floor of x is the largest element in the array smaller than or equal to x.… Read More
A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’… Read More
Given a number n, find the cube root of n.Examples:   Input: n = 3 Output: Cubic Root is 1.442250 Input: n = 8 Output: Cubic… Read More
Given a set of strings, find the longest common prefix.   Input : {“geeksforgeeks”, “geeks”, “geek”, “geezer”} Output : "gee" Input : {"apple", "ape", "april"} Output… Read More
I got interviewed by MAQ via Skype and they asked me below three question and the duration was 20 min :- 1. Write a program… Read More
Binary search is a widely used searching algorithm that requires the array to be sorted before search is applied. The main idea behind this algorithm… Read More
A rational is represented as p/qb, for example 2/3. Given a sorted array of rational numbers, how to search an element using Binary Search. Use… Read More

Start Your Coding Journey Now!