Created
May 1, 2017 22:13
-
-
Save riceball1/b4cf5e36d6228302f162ddff03c03c5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class binarySearch { | |
constructor() { | |
this.left = 0; | |
this.right = 0; | |
this.middle = 0; | |
} | |
search(array, value){ | |
this.middle = (array.length - 1) / 2; | |
this.left = middle - 1; | |
this.right = middle + 1; | |
if(value == middle) { | |
return array[middle]; | |
} else { | |
// | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment