Skip to content

Files

Latest commit

71680c5 · Sep 4, 2018

History

History
This branch is 8 commits ahead of, 454 commits behind trekhleb/javascript-algorithms:master.

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 4, 2018
Sep 4, 2018
Sep 4, 2018

Nth Power using Binary Search

In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop,is a search algorithm that finds the position of a target value within a range or sorted array. Binary search compares the target value to the middle element of the range or array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array. Even though the idea is simple, implementing binary search correctly requires attention to some subtleties about its exit conditions and midpoint calculation.

Nth Root

References