1×
Become a member
to unlock all features
Autoplay

    Refactor a Linear Search into a Binary Search with JavaScript

    javascriptJavaScript

    Binary search is an algorithm that accepts a sorted list and returns a search element from the list. It provides a dramatic performance boost over searching linearly through a list for an element. Let’s play around number of iterations required for each search method to complete and refactor our linear list search into a binary search function.