You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function BinarySearch(array, element, minIndex, maxIndex) { // array = sorted array, element = element to be found, minIndex = low index, maxIndex = high index
if (minIndex > maxIndex) {
logger._print(element + ' is not found!');
return -1;
}
var middleIndex = Math.floor((minIndex + maxIndex) / 2);
var testElement = array[middleIndex];
tracer._select(minIndex, maxIndex)._wait();
tracer._notify(middleIndex);
logger._print('Searching at index: ' + middleIndex)._wait();