kryshtalovich/algorithms
Composer 安装命令:
composer require kryshtalovich/algorithms
包简介
Sort and search algorithms
README 文档
README
In this repository I'm implementing various algorithms. Currently, a bubble sort algorithm and a binary search algorithm are implemented.
Installation
Require the package in composer.json
"require": { "kryshtalovich/algorithms": "1.*" }
Usage
Bubble sorting
use Kryshtalovich\Algorithms\Sorts\Bubble; //any numeric array $array = [9, 7, 5, 6, 545, 66, 0, 4]; Bubble::Sort($array); var_dump($array);
Output:
array(8) {
[0]=>
int(0)
[1]=>
int(4)
[2]=>
int(5)
[3]=>
int(6)
[4]=>
int(7)
[5]=>
int(9)
[6]=>
int(66)
[7]=>
int(545)
}
Binary searching
use Kryshtalovich\Algorithms\Search\Binary; //any numeric array $array = [7, 7.5, 8, 8.3, 9.4]; $elementKey = Binary::Search($array, 8.3); var_dump($elementKey);
Output:
int(3)
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2020-11-20