mirror of
https://github.com/TheAlgorithms/PHP.git
synced 2025-01-17 15:18:13 +01:00
update TernarySearch Algorithm
This commit is contained in:
parent
896fcd8034
commit
0b0e0b4fa7
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user