Skip to content

Glossary: Data Structures and Algorithms in Java

binary search

Finding an item in a sorted array by checking the middle and discarding the half that cannot hold the target, repeating until found. It takes O(log n) steps.

Where the book teaches it

Related terms

Arrays.binarySearchoff-by-one errorBig-O shapes (O(1), O(log n), O(n), O(n log n), O(n²), O(V + E))