Find bitonic point in given bitonic sequence

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 »

Find all sides of a right angled triangle from given hypotenuse and area | Set 1

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 »

Find the only repeating element in a sorted array of size n

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 »

Find the prime numbers which can written as sum of most consecutive primes

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() in Java with examples | Set 1

Arrays.binarySearch() is the simplest and most efficient method to find an element in a sorted array in Java Declaration: public static int binarySearch(data_type arr, data_type… Read More »

Nearest prime less than given number n

You are given a number n ( 3 <= n < 10^6 ) and you have to find nearest prime less than n? Examples: Input… Read More »

Collections.binarySearch() in Java with Examples

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 »

Linear Search vs Binary Search

Prerequisite: Linear Search Binary Search A linear search scans one item at a time, without jumping to any item . The worst case complexity is  O(n),… Read More »

Floor in a Sorted Array

Given a sorted array and a value x, the floor of x is the largest element in array smaller than or equal to x. Write… Read More »

Finding minimum vertex cover size of a graph using binary search

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 »

Find cubic root of a number

Given a number n, find the cube root of n. Examples: Input: n = 3 Output: Cubic Root is 1.442250 Input: n = 8 Output:… Read More »

Longest Common Prefix using Binary Search

Given a set of strings, find the longest common prefix. Input : {“geeksforgeeks”, “geeks”, “geek”, “geezer”} Output : “gee” Input : {“apple”, “ape”, “april”} Output… Read More »

MAQ Software Interview Experience | Set 12 (Written Test)

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 in C++ Standard Template Library (STL)

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 »

Binary Search for Rational Numbers without using floating point arithmetic

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 »