Coder Social home page Coder Social logo

crimsonnynja / php-trees Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 172 KB

Tree implementations for PHP

License: GNU General Public License v3.0

PHP 100.00%
php tree trees binary-search-tree rope rope-string bst generic-tree binaryheap binaryheap-array

php-trees's Introduction

PHP-Trees

GitHub Workflow build status badge Latest Stable Version

This repo is designed to have all common trees used in an easy to use php way

Current included are implementations of a Binary Search Tree, Rope, Binary Heap, and a Generic Tree, with more to come!

All tests are written in PHP Unit, and all code is written in the PSR-4 standards. Php Trees also requires PHP 8.1.0 or above, and utilizes all modern features of PHP.

PHP Trees can be installed through composer with

composer require crimson-nynja/php-trees

https://packagist.org/packages/crimson-nynja/php-trees

Usage

To use the binary search tree, include the correct file and create it as such

use PhpTrees\BinarySearchTree;

$b = new BinarySearchTree(rootValue: 5);
// This will create a binary search tree with a root of the value 5

To use the Rope

use PhpTrees\Rope;

$r = new Rope(string: "This is a Rope!");
// This will create a Rope with the initial string, "This is a Rope!"

To use the Binary Heap

use PhpTrees\BinaryHeap;

$h = new BinaryHeap();
// This will create an empty binary heap

To use the Generic Tree

use PhpTrees\GenericTree;

$g = new GenericTree(rootValue: 4.1);
// This will create a generic tree with root 4.1

For a more detailed description of the features of PHP Trees, check out the wiki
https://github.com/CrimsonNynja/PHP-Trees/wiki

Coming up

tree balancing options
2-3 tree
B-Tree
search/traversal types (depth first search breadth first search, etc)

php-trees's People

Contributors

crimsonnynja avatar

Stargazers

 avatar

Watchers

 avatar  avatar

php-trees's Issues

PHP 8 upgrade

Repo should be updated to utilise new PHP 8 features, this will be done over multiple commits

  • named arguments
  • constructor property promotion
  • union types | new types (mixed etc.)
  • null safe operator
  • upgrade dependencies when update available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.