这是一组在 PHP 中实现的常用算法,该集合基于 Gayle Laakmann McDowell 的《破解编码面试》(Cracking the Coding Interview) 书中介绍的算法。
这是一组在 PHP 中实现的常用算法,该集合基于 Gayle Laakmann McDowell 的《破解编码面试》(Cracking the Coding Interview) 书中介绍的算法。
这是一组在 PHP 中实现的常用算法,该集合基于 Gayle Laakmann McDowell 的《破解编码面试》(Cracking the Coding Interview) 书中描述的算法。 您可以在 Packagist 上找到该包: https://packagist.org/packages/doganoo/php-algorithms
"算法 + 数据结构 = 程序" 算法是解决问题的基本工具之一。数据结构以高效的方式组织数据。两者的结合可以创建智能且高效的软件。
您可以通过 composer 安装该包:
composer require doganoo/php-algorithms这里有一个二叉树示例:
use doganoo\PHPAlgorithms\Datastructure\Graph\Tree\BinaryTree;
$binaryTree = new BinaryTree();
$binaryTree->insertValue(50);
$binaryTree->insertValue(25);
$binaryTree->insertValue(75);
$binaryTree->insertValue(10);
$binaryTree->insertValue(100);
echo json_encode($binaryTree);生产
{"nodes":{"value":50,"left":{"value":25,"left":{"value":10,"left":null,"right":null},"right":null},"right":{"value":75,"left":null,"right":{"value":100,"left":null,"right":null}}}}欢迎发送 Pull Request 以添加更多算法和数据结构。请在提交 PR 前阅读 https://github.com/doganoo/PHPAlgorithms/wiki/Best-Practices。此外,请考虑 https://github.com/doganoo/PHPAlgorithms/blob/master/CONTRIBUTING.md.
暂无开放 Issues,或尚未同步最近议题。