@leftynaut/Binary Search Tree
JavaScript

No description

I built🔨
THIS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var total = 0;
var one;

function fun(){
	var min = 1;
	var max = 1000000;
	var guess;
	var number = Math.floor(Math.random() * max) + min;
	var counter = 0;
	
	while (guess !== number){
	        counter += 1;
		guess = Math.floor((min + max) / 2);
		if (number > guess){
			min = guess + 1;
		} else if (number < guess) {
			max = guess - 1;
		}
	}
	total += 1;
	if (counter === 1){
		one = 1;
	}
	
}
while (one !== 1){
	fun();
}
console.log(total)
Native Browser JavaScript