Answers for "busca binária em javascript"

1

busca binária em javascript

function linearSearch(value, list) {
    let found = false;
    let position = -1;
    let index = 0;
 
    while(!found && index < list.length) {
        if(list[index] == value) {
            found = true;
            position = index;
        } else {
            index += 1;
        }
    }
    return position;
}
Posted by: Guest on June-11-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language