// Recursive Binary Search
function recursive(list, target) {
if (list.length === 0) {
return false;
} else {
let midpoint = Math.floor(list.length / 2);
if (list[midpoint] === target) {
return true;
} else {
if (list[midpoint] < target) {
return recursive(list[midpoint + 1], target);
} else {
if (list[midpoint] > target) return recursive(list[midpoint], target);
}
}
}
}
function verifyRecursive(result) {
return Target found : ${result}
;
}
Top comments (4)
Probably that :
Thank you for your response. I really appreciate the help
We can't help you like this, please take some time, read the editor guide, and try to compose the question a bit better and you will be more likely to be helped. You can't expect us to do all the job right? ;D
This is not a good way to ask for help. Simply saying "this does not work" tells us nothing.