[dichotomy algorithm] PHP implementation of binary search algorithm

$a = array(1,2,33,24,15,16,7,8);
function find2($a,$findValue){
    * [url= home.php?mod=space&uid=170990 ]@Name [/ url] dichotomy search algorithm
    * [url= home.php?mod=space&uid=686208 ]@Author [/ url]
    * [url= home.php?mod=space&uid=952169 ]@Param [/ url] $a: array passed, $findvlaue: value to find
    * [url= home.php?mod=space&uid=155549 ]@Return [/ url] true found, false not found
    $heigh = count((array)$a)-1;
    $low = 0;
    while ($heigh>=$low) {
        $mid = round(($heigh+$low)/2);
        Echo "find". A [$mid]. PHP_ EOL;
            $low = $mid+1;
        }elseif ($findValue

Bisection algorithm PHP implementation of binary search algorithm

Recommended Today

MVC and Vue

MVC and Vue This article was written on July 27, 2020 The first question is: is Vue an MVC or an MVVM framework? Wikipedia tells us: MVVM is a variant of PM, and PM is a variant of MVC. So to a certain extent, whether Vue is MVC or MVVM or not, its ideological direction […]