## Find square root of a number using binary search algorithm

Given a positive number, find square root of it. If the number is not a perfect square, then return floor of its square root.

Coding made easy

Given a positive number, find square root of it. If the number is not a perfect square, then return floor of its square root.

Given a monotonically increasing function f(x), find the value of x where f(x) becomes positive for the first time. In other words, find a positive integer x such that f(x-1), f(x-2),… are negative and f(x+1), f(x+2),… are positive.

Given an array of integers where every element appears even number of times except one element which appears odd number of times, find that odd occurring element in O(log(n)) time and constant space.

Given a sequence of numbers such that the difference between the consecutive terms is constant, find missing term in it in O(log(n)) time.

In this post, we will discuss division of two numbers (integer or decimal) using Binary Search Algorithm.

Given a sorted array of integers, find floor and ceil of a given number in it. The floor and ceiling map the given number to the largest previous or the smallest following integer, respectively.

In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.

Given an array, find peak element in it. A peak element is an element that is greater than its neighbors.

Given a sorted binary array, efficiently find the number of 1’s in it.

Given a nearly sorted array such that each of the N elements may be misplaced by no more than one position from the correct sorted order, efficiently search a given element in it. Report if the element is not present in the input array.

Given a sorted array of integers, find floor and ceil of a given number in it. The floor and ceil map the given number to the largest previous or the smallest following integer, respectively.

Given a sorted array of distinct non-negative integers, find smallest missing element in it.