Skip to content

Instantly share code, notes, and snippets.

@riceball1
Created May 1, 2017 22:13
Show Gist options
  • Save riceball1/b4cf5e36d6228302f162ddff03c03c5e to your computer and use it in GitHub Desktop.
Save riceball1/b4cf5e36d6228302f162ddff03c03c5e to your computer and use it in GitHub Desktop.
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