Divide and Conquer: Binary Search in JavaScriptby@Swordfish
4,724 reads

Divide and Conquer: Binary Search in JavaScript

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Binary Search in JavaScript uses a brute force method to solve search problems. The Big O notation of brute force is usually and unacceptably equal to or greater than bigO(n²) Binary Search will not work for an unsorted list because it uses a sort of educated guess. The standard implementation of binary search is:Start a while loop that will terminate if the target is not found. Reassign the start index or the end index to the guess index. You reassign your guess to the middle of the halved array.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Divide and Conquer: Binary Search in JavaScript
Randy HackerNoon profile picture

@Swordfish

Randy

JS, React, Redux, Ruby, Rails, SQL, Python


Receive Stories from @Swordfish

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!