mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-28 04:13:43 +03:00
18 lines
386 B
JavaScript
Executable File
18 lines
386 B
JavaScript
Executable File
'use strict';
|
|
|
|
function ifBinaryFound(target, sortedArray) {
|
|
var istart = 0;
|
|
var iend = sortedArray.length - 1;
|
|
|
|
while (istart < iend) {
|
|
var imid = istart + Math.floor( (iend - istart)*0.5 );
|
|
if (target > sortedArray[imid])
|
|
istart = imid + 1;
|
|
else
|
|
iend = imid;
|
|
}
|
|
|
|
return target === sortedArray[iend];
|
|
}
|
|
|
|
module.exports = ifBinaryFound; |