update TernarySearch Algorithm

This commit is contained in:
ayDavidGitHere 2022-11-01 07:26:21 +01:00
parent 896fcd8034
commit 0b0e0b4fa7

View File

@ -12,7 +12,7 @@ function ternarySearchByRecursion ($arr, $key, $low, $high) {
//Return -1 if high lesser than low, we can't find item in the whole array
if ($high < $low) {
return -1;
return null;
}
@ -79,5 +79,5 @@ function ternarySearchIterative ($arr, $key) {
}
}
// the $key was not found
return -1;
}
return null;
}