PHP code example of ddlzz / bisect
1. Go to this page and download the library: Download ddlzz/bisect library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ddlzz / bisect example snippets
declare(strict_types=1);
use Ddlzz\Bisect\Bisect;
23,
55,
127,
128,
200,
250,
300,
312,
];
$leftKey = Bisect::left($array, 100); // returns 2
$leftKey = Bisect::left($array, 55); // returns 1
$rightKey = Bisect::right($array, 55); // returns 2