paint-brush
Divide and Conquer: Binary Search in JavaScriptby@Swordfish
4,908 reads
4,908 reads

Divide and Conquer: Binary Search in JavaScript

by Randy7mNovember 14th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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
Randy

Randy

@Swordfish

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

About @Swordfish
LEARN MORE ABOUT @SWORDFISH'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Randy HackerNoon profile picture
Randy@Swordfish
JS, React, Redux, Ruby, Rails, SQL, Python

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite