├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── INSTALL.md ├── LICENSE ├── README.md ├── TERMS.md ├── bin ├── pdepend ├── phpcbf ├── phpcpd ├── phpcs ├── phpdox ├── phploc ├── phpmd └── phpunit ├── bower.json ├── build.xml ├── build ├── api │ ├── classes.html │ ├── css │ │ ├── source.css │ │ └── style.css │ ├── index.html │ ├── interfaces.html │ ├── namespaces.html │ └── traits.html ├── coverage │ ├── css │ │ ├── bootstrap.min.css │ │ ├── nv.d3.min.css │ │ └── style.css │ ├── dashboard.html │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── index.html │ ├── js │ │ ├── bootstrap.min.js │ │ ├── d3.min.js │ │ ├── holder.min.js │ │ ├── html5shiv.min.js │ │ ├── jquery.min.js │ │ ├── nv.d3.min.js │ │ └── respond.min.js │ ├── src │ │ ├── BinarySearchTree.php.html │ │ ├── BinarySearchTreeNode.php.html │ │ ├── BinaryTree.php.html │ │ ├── BinaryTreeNode.php.html │ │ ├── DataStructure.php.html │ │ ├── DataStructureNode.php.html │ │ ├── DoubleLinkedList.php.html │ │ ├── DoubleLinkedListNode.php.html │ │ ├── LinkedList.php.html │ │ ├── Listable.php.html │ │ ├── Queue.php.html │ │ ├── Searchable.php.html │ │ ├── SingleLinkedList.php.html │ │ ├── SingleLinkedListNode.php.html │ │ ├── Sortable.php.html │ │ ├── Stack.php.html │ │ ├── Traversable.php.html │ │ ├── TreeInterface.php.html │ │ ├── TreeNodeInterface.php.html │ │ ├── dashboard.html │ │ └── index.html │ ├── vendor │ │ ├── dashboard.html │ │ ├── index.html │ │ ├── nikic │ │ │ ├── dashboard.html │ │ │ ├── index.html │ │ │ └── php-parser │ │ │ │ ├── dashboard.html │ │ │ │ ├── index.html │ │ │ │ └── lib │ │ │ │ ├── PhpParser │ │ │ │ ├── Autoloader.php.html │ │ │ │ ├── dashboard.html │ │ │ │ └── index.html │ │ │ │ ├── dashboard.html │ │ │ │ └── index.html │ │ └── sebastian │ │ │ ├── dashboard.html │ │ │ ├── index.html │ │ │ └── recursion-context │ │ │ ├── dashboard.html │ │ │ ├── index.html │ │ │ └── src │ │ │ ├── Context.php.html │ │ │ ├── dashboard.html │ │ │ └── index.html │ └── xml │ │ ├── index.xml │ │ ├── src │ │ ├── BinarySearchTree.php.xml │ │ ├── BinarySearchTreeNode.php.xml │ │ ├── BinaryTree.php.xml │ │ ├── BinaryTreeNode.php.xml │ │ ├── DataStructure.php.xml │ │ ├── DataStructureNode.php.xml │ │ ├── DoubleLinkedList.php.xml │ │ ├── DoubleLinkedListNode.php.xml │ │ ├── LinkedList.php.xml │ │ ├── Listable.php.xml │ │ ├── Queue.php.xml │ │ ├── Searchable.php.xml │ │ ├── SingleLinkedList.php.xml │ │ ├── SingleLinkedListNode.php.xml │ │ ├── Sortable.php.xml │ │ ├── Stack.php.xml │ │ ├── Traversable.php.xml │ │ ├── TreeInterface.php.xml │ │ └── TreeNodeInterface.php.xml │ │ └── vendor │ │ ├── nikic │ │ └── php-parser │ │ │ └── lib │ │ │ └── PhpParser │ │ │ └── Autoloader.php.xml │ │ └── sebastian │ │ └── recursion-context │ │ └── src │ │ └── Context.php.xml ├── logs │ ├── changes.diff │ ├── clover.xml │ ├── crap4j.xml │ ├── jdepend.xml │ ├── junit.xml │ ├── phploc.csv │ ├── phploc.xml │ ├── pmd-cpd.xml │ └── pmd.xml ├── pdepend │ ├── dependencies.svg │ └── overview-pyramid.svg ├── phpdox.xml ├── phpdox │ ├── index.xml │ └── source.xml ├── phpmd.xml └── phpunit.xml ├── cache.properties ├── composer.json ├── opensource-checklist.md ├── screenshot.png ├── src ├── BasicGraph.php ├── BasicVertex.php ├── BinarySearchTree.php ├── BinarySearchTreeNode.php ├── BinaryTree.php ├── BinaryTreeNode.php ├── DataStructure.php ├── DataStructureNode.php ├── DirectedGraph.php ├── DirectedVertex.php ├── DoubleLinkedList.php ├── DoubleLinkedListNode.php ├── Graph.php ├── Heap.php ├── LinkedList.php ├── Listable.php ├── Queue.php ├── Searchable.php ├── SingleLinkedList.php ├── SingleLinkedListNode.php ├── Sortable.php ├── Stack.php ├── Traversable.php ├── TreeInterface.php ├── TreeNodeInterface.php └── Vertex.php └── tests ├── BinarySearchTreeTest.php ├── DoubleLinkedListTest.php ├── QueueTest.php ├── SingleLinkedListTest.php ├── SortableTest.php └── StackTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.lock -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | All notable changes to this project will be documented in this file. 2 | We follow the [Semantic Versioning 2.0.0](http://semver.org/) format. 3 | 4 | 5 | ## x.y.z - YYYY-MM-DD 6 | 7 | ### Added 8 | - Lorem ipsum dolor sit amet 9 | 10 | ### Deprecated 11 | - Nothing. 12 | 13 | ### Removed 14 | - Nothing. 15 | 16 | ### Fixed 17 | - Nothing. 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Guidance on how to contribute 2 | 3 | > All contributions to this project will be released under the CC0 public domain 4 | > dedication. By submitting a pull request or filing a bug, issue, or 5 | > feature request, you are agreeing to comply with this waiver of copyright interest. 6 | > Details can be found in our [TERMS](TERMS.md) and [LICENCE](LICENSE). 7 | 8 | 9 | There are two primary ways to help: 10 | - Using the issue tracker, and 11 | - Changing the code-base. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | Use the issue tracker to suggest feature requests, report bugs, and ask questions. 17 | This is also a great way to connect with the developers of the project as well 18 | as others who are interested in this solution. 19 | 20 | Use the issue tracker to find ways to contribute. Find a bug or a feature, mention in 21 | the issue that you will take on that effort, then follow the _Changing the code-base_ 22 | guidance below. 23 | 24 | 25 | ## Changing the code-base 26 | 27 | Generally speaking, you should fork this repository, make changes in your 28 | own fork, and then submit a pull-request. All new code should have associated unit 29 | tests that validate implemented features and the presence or lack of defects. 30 | Additionally, the code should follow any stylistic and architectural guidelines 31 | prescribed by the project. In the absence of such guidelines, mimic the styles 32 | and patterns in the existing code-base. 33 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installation instructions 2 | 3 | Detailed instructions on how to install, configure, and get the project running. 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Data Structures And Algorithms using PHP 2 | 3 | **Description**: Data Structures and Algorithms preparation for technical interview. Hence I am a php person, I had to recreate these classes using PHP to repeat CS topics. 4 | 5 | Includes: 6 | - Stack 7 | - Queue 8 | - Single Linked List 9 | - Double Linked List 10 | - BinarySearchTree 11 | - Sorting Algorithms 12 | - Bucket Sort 13 | - Bubble Sort 14 | - Selection Sort 15 | - Shell Sort 16 | - Insertion Sort 17 | - Insertion Sort with Array 18 | - Merge Sort 19 | - Quick Sort 20 | - Tests 21 | - Other classes are not completed. 22 | 23 | Other things to include: 24 | 25 | - **Technology stack**: PHP, Composer and maybe bower and grunt should be installed 26 | - **Status**: Very very Alpha [CHANGELOG](CHANGELOG.md). 27 | - **Links to production or demo instances** 28 | - [PHP Psr-4 Template](http://culttt.com/2014/05/07/create-psr-4-php-package/) and [Open Source Project Template](https://github.com/cfpb/open-source-project-template) 29 | 30 | ## Installation 31 | 32 | 1. Create a new directory. 33 | 2. Copy these files into the new directory. 34 | 3. composer install 35 | 36 | ## Configuration 37 | 38 | There is no configuration yet 39 | 40 | ## Usage 41 | 42 | Study for your next big company interview. 43 | 44 | ## How to test the software 45 | 46 | just build/phpunit 47 | 48 | ## Known issues 49 | 50 | No issues yet 51 | 52 | ## Getting help 53 | 54 | This package can be used to intuitiveliy. But if you have questions you can ask me anything. 55 | 56 | **Example** 57 | 58 | Feel free to mail mtkocak@gmail.com 59 | 60 | ## Getting involved 61 | 62 | You can fork this packade. 63 | 64 | I did not update [CONTRIBUTING](CONTRIBUTING.md) yet. 65 | 66 | 67 | ---- 68 | 69 | ## Open source licensing info 70 | 1. [TERMS](TERMS.md) 71 | 2. [LICENSE](LICENSE) 72 | 3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/) 73 | 74 | 75 | ---- 76 | 77 | ## Credits and references 78 | 79 | I already gave credits above but, you can check; 80 | 81 | 1.[PHP Psr-4 Template](http://culttt.com/2014/05/07/create-psr-4-php-package/) 82 | 2.[Open Source Project Template](https://github.com/cfpb/open-source-project-template) 83 | -------------------------------------------------------------------------------- /TERMS.md: -------------------------------------------------------------------------------- 1 | As a work of the United States Government, this package (excluding any 2 | exceptions listed below) is in the public domain within the United States. 3 | Additionally, we waive copyright and related rights in the work worldwide 4 | through the [CC0 1.0 Universal public domain dedication][CC0]. 5 | 6 | Software source code previously released under an open source license and then 7 | modified by CFPB staff or its contractors is considered a "joint work" 8 | (see 17 USC § 101); it is partially copyrighted, partially public domain, 9 | and as a whole is protected by the copyrights of the non-government authors and 10 | must be released according to the terms of the original open-source license. 11 | Segments written by CFPB staff, and by contractors who are developing software 12 | on behalf of CFPB are also in the public domain, and copyright and related 13 | rights for that work are waived through the CC0 1.0 Universal dedication. 14 | 15 | For further details, please see the CFPB [Source Code Policy][policy]. 16 | 17 | 18 | ## CC0 1.0 Universal Summary 19 | 20 | This is a human-readable summary of the [Legal Code (read the full text)][CC0]. 21 | 22 | ### No Copyright 23 | 24 | The person who associated a work with this deed has dedicated the work to 25 | the public domain by waiving all of his or her rights to the work worldwide 26 | under copyright law, including all related and neighboring rights, to the 27 | extent allowed by law. 28 | 29 | You can copy, modify, distribute and perform the work, even for commercial 30 | purposes, all without asking permission. See Other Information below. 31 | 32 | ### Other Information 33 | 34 | In no way are the patent or trademark rights of any person affected by CC0, 35 | nor are the rights that other persons may have in the work or in how the 36 | work is used, such as publicity or privacy rights. 37 | 38 | Unless expressly stated otherwise, the person who associated a work with 39 | this deed makes no warranties about the work, and disclaims liability for 40 | all uses of the work, to the fullest extent permitted by applicable law. 41 | When using or citing the work, you should not imply endorsement by the 42 | author or the affirmer. 43 | 44 | [policy]: https://github.com/cfpb/source-code-policy/ 45 | [CC0]: http://creativecommons.org/publicdomain/zero/1.0/legalcode 46 | 47 | 48 | ## Exceptions 49 | 50 | _Source code or other assets that are excluded from the TERMS should be listed 51 | here. These may include dependencies that may be licensed differently or are 52 | not in the public domain._ 53 | -------------------------------------------------------------------------------- /bin/pdepend: -------------------------------------------------------------------------------- 1 | ../vendor/pdepend/pdepend/src/bin/pdepend -------------------------------------------------------------------------------- /bin/phpcbf: -------------------------------------------------------------------------------- 1 | ../vendor/squizlabs/php_codesniffer/scripts/phpcbf -------------------------------------------------------------------------------- /bin/phpcpd: -------------------------------------------------------------------------------- 1 | ../vendor/sebastian/phpcpd/phpcpd -------------------------------------------------------------------------------- /bin/phpcs: -------------------------------------------------------------------------------- 1 | ../vendor/squizlabs/php_codesniffer/scripts/phpcs -------------------------------------------------------------------------------- /bin/phpdox: -------------------------------------------------------------------------------- 1 | ../vendor/theseer/phpdox/composer/bin/phpdox -------------------------------------------------------------------------------- /bin/phploc: -------------------------------------------------------------------------------- 1 | ../vendor/phploc/phploc/phploc -------------------------------------------------------------------------------- /bin/phpmd: -------------------------------------------------------------------------------- 1 | ../vendor/phpmd/phpmd/src/bin/phpmd -------------------------------------------------------------------------------- /bin/phpunit: -------------------------------------------------------------------------------- 1 | ../vendor/phpunit/phpunit/phpunit -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "php-algorithms", 3 | "version": "0.1.0", 4 | "homepage": "http://www.mtkocak.com", 5 | "authors": [ 6 | "Midori Koçak " 7 | ], 8 | "description": "PHP Algorithms By Midori Kocak", 9 | "keywords": [ 10 | "php", 11 | "algorithms", 12 | "data", 13 | "structures" 14 | ], 15 | "license": "MIT", 16 | "ignore": [ 17 | "**/.*", 18 | "node_modules", 19 | "bower_components", 20 | "test", 21 | "tests" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /build/api/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | phpDox - Overview 5 | 6 | 7 | 8 | 9 | 22 |
23 |

Classes

24 |
25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /build/api/css/source.css: -------------------------------------------------------------------------------- 1 | table.source { 2 | border:0; 3 | padding:0; 4 | margin:0; 5 | border-collapse: collapse; 6 | } 7 | 8 | table.source td { 9 | border:1px solid #ccc; 10 | vertical-align: top; 11 | font-size: 1em; 12 | line-height: 1.4em; 13 | font-family: monospace; 14 | } 15 | 16 | table.source td.no a { 17 | display:block; 18 | color: #ccc; 19 | text-align: right; 20 | padding: 0 8px; 21 | text-decoration: none; 22 | } 23 | 24 | table.source pre { 25 | padding:0; 26 | margin:0; 27 | } 28 | 29 | table.source pre span { 30 | display:inline; 31 | } 32 | 33 | table.source td.line div { 34 | padding:80px 0 0 0; 35 | margin:-80px 0 0 0; 36 | cursor: text; 37 | } 38 | 39 | table.source td.line pre:hover { 40 | background-color: #eee; 41 | } 42 | 43 | table.source td.line div:target pre { 44 | background-color: #ffffc8; 45 | } 46 | 47 | .token { 48 | color: #0000BB; 49 | } 50 | 51 | .T_COMMENT, .T_DOC_COMMENT { 52 | color: #FF8000; 53 | } 54 | 55 | .T_ABSTRACT, 56 | .T_ARRAY, 57 | .T_AS, 58 | .T_BREAK, 59 | .T_CALLABLE, 60 | .T_CASE, 61 | .T_CATCH, 62 | .T_CLASS, 63 | .T_CLONE, 64 | .T_CONTINUE, 65 | .T_DEFAULT, 66 | .T_ECHO, 67 | .T_ELSE, 68 | .T_ELSEIF, 69 | .T_EMPTY, 70 | .T_ENDDECLARE, 71 | .T_ENDFOR, 72 | .T_ENDFOREACH, 73 | .T_ENDIF, 74 | .T_ENDSWITCH, 75 | .T_ENDWHILE, 76 | .T_EXIT, 77 | .T_EXTENDS, 78 | .T_FINAL, 79 | .T_FINALLY, 80 | .T_FOREACH, 81 | .T_FUNCTION, 82 | .T_GLOBAL, 83 | .T_IF, 84 | .T_IMPLEMENTS, 85 | .T_INCLUDE, 86 | .T_INCLUDE_ONCE, 87 | .T_INSTANCEOF, 88 | .T_INSTEADOF, 89 | .T_INTERFACE, 90 | .T_ISSET, 91 | .T_LOGICAL_AND, 92 | .T_LOGICAL_OR, 93 | .T_LOGICAL_XOR, 94 | .T_NAMESPACE, 95 | .T_NEW, 96 | .T_PRIVATE, 97 | .T_PROTECTED, 98 | .T_PUBLIC, 99 | .T_REQUIRE, 100 | .T_REQUIRE_ONCE, 101 | .T_RETURN, 102 | .T_STATIC, 103 | .T_THROW, 104 | .T_TRAIT, 105 | .T_TRY, 106 | .T_UNSET, 107 | .T_USE, 108 | .T_VAR, 109 | .T_WHILE, 110 | .T_YIELD, 111 | .T_PHPDOX_OPEN_BRACKET, 112 | .T_PHPDOX_CLOSE_BRACKET, 113 | .T_PHPDOX_OPEN_SQUARE, 114 | .T_PHPDOX_CLOSE_SQUARE, 115 | .T_PHPDOX_OPEN_CURLY, 116 | .T_PHPDOX_CLOSE_CURLY, 117 | .T_PHPDOX_SEMICOLON, 118 | .T_PHPDOX_DOT, 119 | .T_PHPDOX_COMMA, 120 | .T_PHPDOX_EQUAL, 121 | .T_PHPDOX_LT, 122 | .T_PHPDOX_GT, 123 | .T_PHPDOX_PLUS, 124 | .T_PHPDOX_MINUS, 125 | .T_PHPDOX_MULT, 126 | .T_PHPDOX_DIV, 127 | .T_PHPDOX_QUESTION_MARK, 128 | .T_PHPDOX_EXCLAMATION_MARK, 129 | .T_PHPDOX_COLON, 130 | .T_PHPDOX_DOUBLE_QUOTES, 131 | .T_PHPDOX_AT, 132 | .T_PHPDOX_AMPERSAND, 133 | .T_PHPDOX_PERCENT, 134 | .T_PHPDOX_PIPE, 135 | .T_PHPDOX_DOLLAR, 136 | .T_PHPDOX_CARET, 137 | .T_PHPDOX_TILDE, 138 | .T_PHPDOX_BACKTICK { 139 | color: #007700; 140 | } 141 | 142 | .T_CONSTANT_ENCAPSED_STRING, .T_ENCAPSED_AND_WHITESPACE { 143 | color: #DD0000; 144 | } 145 | -------------------------------------------------------------------------------- /build/api/interfaces.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | phpDox - Overview 5 | 6 | 7 | 8 | 9 | 22 |
23 |

Interfaces

24 |
25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /build/api/namespaces.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | phpDox - Overview 6 | 7 | 8 | 9 | 10 | 23 |
24 |

Namespaces

25 |
26 |

Namespaces

27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
NameInterfacesClassesTraits
37 |
38 |
39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /build/api/traits.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | phpDox - Overview 5 | 6 | 7 | 8 | 9 | 22 |
23 |

Traits

24 |
25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /build/coverage/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 10px; 3 | } 4 | 5 | .popover { 6 | max-width: none; 7 | } 8 | 9 | .glyphicon { 10 | margin-right:.25em; 11 | } 12 | 13 | .table-bordered>thead>tr>td { 14 | border-bottom-width: 1px; 15 | } 16 | 17 | .table tbody>tr>td, .table thead>tr>td { 18 | padding-top: 3px; 19 | padding-bottom: 3px; 20 | } 21 | 22 | .table-condensed tbody>tr>td { 23 | padding-top: 0; 24 | padding-bottom: 0; 25 | } 26 | 27 | .table .progress { 28 | margin-bottom: inherit; 29 | } 30 | 31 | .table-borderless th, .table-borderless td { 32 | border: 0 !important; 33 | } 34 | 35 | .table tbody tr.covered-by-large-tests, li.covered-by-large-tests, tr.success, td.success, li.success, span.success { 36 | background-color: #dff0d8; 37 | } 38 | 39 | .table tbody tr.covered-by-medium-tests, li.covered-by-medium-tests { 40 | background-color: #c3e3b5; 41 | } 42 | 43 | .table tbody tr.covered-by-small-tests, li.covered-by-small-tests { 44 | background-color: #99cb84; 45 | } 46 | 47 | .table tbody tr.danger, .table tbody td.danger, li.danger, span.danger { 48 | background-color: #f2dede; 49 | } 50 | 51 | .table tbody td.warning, li.warning, span.warning { 52 | background-color: #fcf8e3; 53 | } 54 | 55 | .table tbody td.info { 56 | background-color: #d9edf7; 57 | } 58 | 59 | td.big { 60 | width: 117px; 61 | } 62 | 63 | td.small { 64 | } 65 | 66 | td.codeLine { 67 | font-family: monospace; 68 | white-space: pre; 69 | } 70 | 71 | td span.comment { 72 | color: #888a85; 73 | } 74 | 75 | td span.default { 76 | color: #2e3436; 77 | } 78 | 79 | td span.html { 80 | color: #888a85; 81 | } 82 | 83 | td span.keyword { 84 | color: #2e3436; 85 | font-weight: bold; 86 | } 87 | 88 | pre span.string { 89 | color: #2e3436; 90 | } 91 | 92 | span.success, span.warning, span.danger { 93 | margin-right: 2px; 94 | padding-left: 10px; 95 | padding-right: 10px; 96 | text-align: center; 97 | } 98 | 99 | #classCoverageDistribution, #classComplexity { 100 | height: 200px; 101 | width: 475px; 102 | } 103 | 104 | #toplink { 105 | position: fixed; 106 | left: 5px; 107 | bottom: 5px; 108 | outline: 0; 109 | } 110 | 111 | svg text { 112 | font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif; 113 | font-size: 11px; 114 | color: #666; 115 | fill: #666; 116 | } 117 | 118 | .scrollbox { 119 | height:245px; 120 | overflow-x:hidden; 121 | overflow-y:scroll; 122 | } 123 | -------------------------------------------------------------------------------- /build/coverage/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midorikocak/algorithms-and-data-structures/3422ae20f97ba414814544de08d3335ca80db76c/build/coverage/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /build/coverage/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midorikocak/algorithms-and-data-structures/3422ae20f97ba414814544de08d3335ca80db76c/build/coverage/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /build/coverage/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midorikocak/algorithms-and-data-structures/3422ae20f97ba414814544de08d3335ca80db76c/build/coverage/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /build/coverage/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midorikocak/algorithms-and-data-structures/3422ae20f97ba414814544de08d3335ca80db76c/build/coverage/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /build/coverage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 24 |
25 |
26 |
27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 53 | 59 | 60 | 61 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 81 | 87 | 88 | 89 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 107 | 108 | 109 | 115 | 116 | 117 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
46 |
47 | 60.42% covered (warning) 48 |
49 |
50 |
60.42%
513 / 849
54 |
55 | 41.67% covered (danger) 56 |
57 |
58 |
41.67%
40 / 96
62 |
63 | 14.29% covered (danger) 64 |
65 |
66 |
14.29%
2 / 14
src
74 |
75 | 62.81% covered (warning) 76 |
77 |
78 |
62.81%
510 / 812
82 |
83 | 43.82% covered (danger) 84 |
85 |
86 |
43.82%
39 / 89
90 |
91 | 8.33% covered (danger) 92 |
93 |
94 |
8.33%
1 / 12
vendor
102 |
103 | 8.11% covered (danger) 104 |
105 |
106 |
8.11%
3 / 37
110 |
111 | 14.29% covered (danger) 112 |
113 |
114 |
14.29%
1 / 7
118 |
119 | 50.00% covered (danger) 120 |
121 |
122 |
50.00%
1 / 2
130 |
131 |
132 |

Legend

133 |

134 | Low: 0% to 50% 135 | Medium: 50% to 90% 136 | High: 90% to 100% 137 |

138 |

139 | Generated by PHP_CodeCoverage 2.1.7 using PHP 5.5.14 and PHPUnit 4.3.5 at Thu Jul 2 15:24:37 CEST 2015. 140 |

141 |
142 |
143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /build/coverage/js/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document); -------------------------------------------------------------------------------- /build/coverage/js/respond.min.js: -------------------------------------------------------------------------------- 1 | /*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl 2 | * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT 3 | * */ 4 | 5 | !function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/src/DataStructureNode.php 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total 
 
 
 
CRAP 
 
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
<?php
namespace Mtkocak\DataStructures;
interface DataStructureNode
{
    public function get();
    public function set($value);
}
75 | 88 |
89 | 90 | 91 | 92 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /build/coverage/src/Listable.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/src/Listable.php 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total 
 
 
 
CRAP 
 
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 |
<?php
namespace Mtkocak\DataStructures;
interface Listable
{
    public function listAll();
}
73 | 86 |
87 | 88 | 89 | 90 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /build/coverage/src/Searchable.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/src/Searchable.php 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total 
 
 
 
CRAP 
 
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
<?php
namespace Mtkocak\DataStructures;
interface Searchable
{
    public function search($value);
}
74 | 87 |
88 | 89 | 90 | 91 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /build/coverage/src/TreeNodeInterface.php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/src/TreeNodeInterface.php 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total 
 
 
 
CRAP 
 
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
<?php
namespace Mtkocak\DataStructures;
interface TreeNodeInterface
{
    public function get();
    public function set($value);
}
75 | 88 |
89 | 90 | 91 | 92 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /build/coverage/vendor/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 25 |
26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 52 | 53 | 54 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 98 | 99 | 100 | 106 | 107 | 108 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
47 |
48 | 8.11% covered (danger) 49 |
50 |
51 |
8.11%
3 / 37
55 |
56 | 14.29% covered (danger) 57 |
58 |
59 |
14.29%
1 / 7
63 |
64 | 50.00% covered (danger) 65 |
66 |
67 |
50.00%
1 / 2
nikic 
 
 
 
81 |
82 | 100.00% covered (success) 83 |
84 |
85 |
100.00%
1 / 1
sebastian
93 |
94 | 8.11% covered (danger) 95 |
96 |
97 |
8.11%
3 / 37
101 |
102 | 14.29% covered (danger) 103 |
104 |
105 |
14.29%
1 / 7
109 |
110 | 0.00% covered (danger) 111 |
112 |
113 |
0.00%
0 / 1
121 |
122 |
123 |

Legend

124 |

125 | Low: 0% to 50% 126 | Medium: 50% to 90% 127 | High: 90% to 100% 128 |

129 |

130 | Generated by PHP_CodeCoverage 2.1.7 using PHP 5.5.14 and PHPUnit 4.3.5 at Thu Jul 2 15:24:37 CEST 2015. 131 |

132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /build/coverage/vendor/nikic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/nikic 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 26 |
27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total 
 
 
 
54 |
55 | 100.00% covered (success) 56 |
57 |
58 |
100.00%
1 / 1
php-parser 
 
 
 
72 |
73 | 100.00% covered (success) 74 |
75 |
76 |
100.00%
1 / 1
84 | 96 |
97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /build/coverage/vendor/nikic/php-parser/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/nikic/php-parser 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 27 |
28 |
29 |
30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total 
 
 
 
55 |
56 | 100.00% covered (success) 57 |
58 |
59 |
100.00%
1 / 1
lib 
 
 
 
73 |
74 | 100.00% covered (success) 75 |
76 |
77 |
100.00%
1 / 1
85 | 97 |
98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /build/coverage/vendor/nikic/php-parser/lib/PhpParser/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/nikic/php-parser/lib/PhpParser 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 29 |
30 |
31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total 
 
 
 
57 |
58 | 100.00% covered (success) 59 |
60 |
61 |
100.00%
1 / 1
Autoloader.php 
 
 
 
75 |
76 | 100.00% covered (success) 77 |
78 |
79 |
100.00%
1 / 1
87 | 99 |
100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /build/coverage/vendor/nikic/php-parser/lib/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/nikic/php-parser/lib 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total 
 
 
 
56 |
57 | 100.00% covered (success) 58 |
59 |
60 |
100.00%
1 / 1
PhpParser 
 
 
 
74 |
75 | 100.00% covered (success) 76 |
77 |
78 |
100.00%
1 / 1
86 | 98 |
99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /build/coverage/vendor/sebastian/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/sebastian 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 26 |
27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 53 | 54 | 55 | 61 | 62 | 63 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 81 | 82 | 83 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 103 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
48 |
49 | 8.11% covered (danger) 50 |
51 |
52 |
8.11%
3 / 37
56 |
57 | 14.29% covered (danger) 58 |
59 |
60 |
14.29%
1 / 7
64 |
65 | 0.00% covered (danger) 66 |
67 |
68 |
0.00%
0 / 1
recursion-context
76 |
77 | 8.11% covered (danger) 78 |
79 |
80 |
8.11%
3 / 37
84 |
85 | 14.29% covered (danger) 86 |
87 |
88 |
14.29%
1 / 7
92 |
93 | 0.00% covered (danger) 94 |
95 |
96 |
0.00%
0 / 1
104 |
105 |
106 |

Legend

107 |

108 | Low: 0% to 50% 109 | Medium: 50% to 90% 110 | High: 90% to 100% 111 |

112 |

113 | Generated by PHP_CodeCoverage 2.1.7 using PHP 5.5.14 and PHPUnit 4.3.5 at Thu Jul 2 15:24:37 CEST 2015. 114 |

115 |
116 |
117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /build/coverage/vendor/sebastian/recursion-context/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/sebastian/recursion-context 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 27 |
28 |
29 |
30 |
31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 54 | 55 | 56 | 62 | 63 | 64 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 84 | 90 | 91 | 92 | 98 | 99 | 100 | 101 | 102 | 103 | 104 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
49 |
50 | 8.11% covered (danger) 51 |
52 |
53 |
8.11%
3 / 37
57 |
58 | 14.29% covered (danger) 59 |
60 |
61 |
14.29%
1 / 7
65 |
66 | 0.00% covered (danger) 67 |
68 |
69 |
0.00%
0 / 1
src
77 |
78 | 8.11% covered (danger) 79 |
80 |
81 |
8.11%
3 / 37
85 |
86 | 14.29% covered (danger) 87 |
88 |
89 |
14.29%
1 / 7
93 |
94 | 0.00% covered (danger) 95 |
96 |
97 |
0.00%
0 / 1
105 |
106 |
107 |

Legend

108 |

109 | Low: 0% to 50% 110 | Medium: 50% to 90% 111 | High: 90% to 100% 112 |

113 |

114 | Generated by PHP_CodeCoverage 2.1.7 using PHP 5.5.14 and PHPUnit 4.3.5 at Thu Jul 2 15:24:37 CEST 2015. 115 |

116 |
117 |
118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /build/coverage/vendor/sebastian/recursion-context/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Code Coverage for /Users/mtkocak/Desktop/php-data-structures/vendor/sebastian/recursion-context/src 6 | 7 | 8 | 9 | 13 | 14 | 15 |
16 |
17 |
18 |
19 | 28 |
29 |
30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 63 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 84 | 85 | 91 | 92 | 93 | 99 | 100 | 101 | 102 | 103 | 104 | 105 |
 
Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50 |
51 | 8.11% covered (danger) 52 |
53 |
54 |
8.11%
3 / 37
58 |
59 | 14.29% covered (danger) 60 |
61 |
62 |
14.29%
1 / 7
66 |
67 | 0.00% covered (danger) 68 |
69 |
70 |
0.00%
0 / 1
Context.php
78 |
79 | 8.11% covered (danger) 80 |
81 |
82 |
8.11%
3 / 37
86 |
87 | 14.29% covered (danger) 88 |
89 |
90 |
14.29%
1 / 7
94 |
95 | 0.00% covered (danger) 96 |
97 |
98 |
0.00%
0 / 1
106 |
107 |
108 |

Legend

109 |

110 | Low: 0% to 50% 111 | Medium: 50% to 90% 112 | High: 90% to 100% 113 |

114 |

115 | Generated by PHP_CodeCoverage 2.1.7 using PHP 5.5.14 and PHPUnit 4.3.5 at Thu Jul 2 15:24:37 CEST 2015. 116 |

117 |
118 |
119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /build/coverage/xml/src/BinarySearchTreeNode.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /build/coverage/xml/src/DataStructure.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/DataStructureNode.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/Listable.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/Queue.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /build/coverage/xml/src/Searchable.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/SingleLinkedList.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /build/coverage/xml/src/SingleLinkedListNode.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /build/coverage/xml/src/Stack.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /build/coverage/xml/src/Traversable.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/TreeInterface.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/src/TreeNodeInterface.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /build/coverage/xml/vendor/nikic/php-parser/lib/PhpParser/Autoloader.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /build/coverage/xml/vendor/sebastian/recursion-context/src/Context.php.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /build/logs/jdepend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 26 7 | 11 8 | 15 9 | 0 10 | 1 11 | 0.57692307692308 12 | 1 13 | 0.57692307692308 14 | 15 | 16 | BinarySearchTree 17 | BinarySearchTreeNode 18 | BinaryTreeNode 19 | DoubleLinkedList 20 | DoubleLinkedListNode 21 | Heap 22 | Queue 23 | SingleLinkedList 24 | SingleLinkedListNode 25 | Sortable 26 | Stack 27 | 28 | 29 | BasicGraph 30 | BasicVertex 31 | BinaryTree 32 | DataStructure 33 | DataStructureNode 34 | Graph 35 | Vertex 36 | Graph 37 | LinkedList 38 | Listable 39 | Searchable 40 | Traversable 41 | TreeInterface 42 | TreeNodeInterface 43 | Vertex 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /build/logs/junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Bucket Sort: 0.036304 32 | 33 | 34 | 35 | Bubble Sort: 0.057313 36 | 37 | 38 | 39 | Selection Sort: 0.055795 40 | 41 | 42 | 43 | Shell Sort: 0.207786 44 | 45 | 46 | 47 | Insertion Sort: 0.0793 48 | 49 | 50 | 51 | Insertion Sort with Array: -0.832012 52 | 53 | 54 | 55 | Merge Sort: 0.126266 56 | 57 | 58 | 59 | Quick Sort: 0.087202 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /build/logs/phploc.csv: -------------------------------------------------------------------------------- 1 | Directories,Files,Lines of Code (LOC),Cyclomatic Complexity / Lines of Code,Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC),LLOC outside functions or classes,Namespaces,Interfaces,Traits,Classes,Abstract Classes,Concrete Classes,Classes Length (LLOC),Average Class Length (LLOC),Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods,Average Method Length (LLOC),Cyclomatic Complexity / Number of Methods,Functions,Named Functions,Anonymous Functions,Functions Length (LLOC),Average Function Length (LLOC),Constants,Global Constants,Class Constants,Attribute Accesses,Non-Static Attribute Accesses,Static Attribute Accesses,Method Calls,Non-Static Method Calls,Static Method Calls,Global Accesses,Global Variable Accesses,Super-Global Variable Accesses,Global Constant Accesses,Test Classes,Test Methods 2 | "1","32","2142","0.25490196078431","115","2027","765","46","1","11","0","15","4","11","587","39.133333333333","151","151","0","146","5","3.887417218543","2.2913907284768","0","0","0","132","0","0","0","0","278","278","0","432","432","0","0","0","0","0","6","26" 3 | -------------------------------------------------------------------------------- /build/logs/phploc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 32 5 | 2142 6 | 765 7 | 587 8 | 132 9 | 46 10 | 115 11 | 195 12 | 195 13 | 11 14 | 0 15 | 15 16 | 4 17 | 11 18 | 0 19 | 0 20 | 0 21 | 151 22 | 146 23 | 5 24 | 151 25 | 0 26 | 0 27 | 0 28 | 0 29 | 6 30 | 26 31 | 0.25490196078431 32 | 2.2913907284768 33 | 39.133333333333 34 | 3.887417218543 35 | 0 36 | 432 37 | 0 38 | 432 39 | 278 40 | 0 41 | 278 42 | 0 43 | 0 44 | 0 45 | 0 46 | 1 47 | 2027 48 | 49 | -------------------------------------------------------------------------------- /build/logs/pmd-cpd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /build/logs/pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Avoid unused private fields such as '$vertices'. 6 | 7 | 8 | Avoid unused private fields such as '$edges'. 9 | 10 | 11 | 12 | 13 | Avoid unused parameters such as '$graph'. 14 | 15 | 16 | 17 | 18 | The class BinarySearchTree has an overall complexity of 51 which is very high. The configured complexity threshold is 50. 19 | 20 | 21 | The method delete() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. 22 | 23 | 24 | The method deleteValue() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10. 25 | 26 | 27 | 28 | 29 | The method depthFirsth() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. 30 | 31 | 32 | 33 | 34 | The class Sortable has an overall complexity of 67 which is very high. The configured complexity threshold is 50. 35 | 36 | 37 | Avoid unused parameters such as '$dataStructure'. 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /build/phpdox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /build/phpdox/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /build/phpdox/source.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /build/phpmd.xml: -------------------------------------------------------------------------------- 1 | 6 | Jumph Ruleset 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /build/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | ../tests/ 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /cache.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 02 15:24:31 CEST 2015 2 | /Users/mtkocak/Desktop/php-algorithms/src/Tree.php=a550a34079c72cc0ddb43f08e655fc56 3 | /Users/mtkocak/Desktop/php-data-structures/src/BinarySearchTree.php=f8b36848850142ce68418c90d4db8fdc 4 | /Users/mtkocak/Desktop/php-data-structures/tests/SingleLinkedListTest.php=48e460ad4df678757c110491d2c16967 5 | /Users/mtkocak/Desktop/php-algorithms/src/CircularLinkedList.php=07cceefc46a80e468fdabef741ba1e87 6 | /Users/mtkocak/Desktop/php-data-structures/src/TreeNodeInterface.php=faefb53fa145bb2d99e89ede4b002f62 7 | /Users/mtkocak/Desktop/php-algorithms/src/Sortable.php=aae7334cc53e7d45e4313f163b73c8f7 8 | /Users/mtkocak/Desktop/php-data-structures/src/SingleLinkedListNode.php=a621038f6ec0582f53f7778d6aa17b91 9 | /Users/mtkocak/Desktop/php-data-structures/src/Queue.php=1010ed5705511d0ea0e5f338878f5d28 10 | /Users/mtkocak/Desktop/php-algorithms/src/Controls.php=058d9cf1f40efd014e1a70baf17dfcd9 11 | /Users/mtkocak/Desktop/php-algorithms/tests/StackTest.php=606b6ecba6eff29fcf496e31c41c159f 12 | /Users/mtkocak/Desktop/php-data-structures/src/BinaryTreeNode.php=1b7683e627daebfc9b210a5af8fa6584 13 | /Users/mtkocak/Desktop/php-algorithms/src/BinaryTree.php=4de31021a2481a85f430d671c8da2afe 14 | /Users/mtkocak/Desktop/php-algorithms/src/DataStructure.php=a9d9500abcf8778e523ccaae80ae8683 15 | /Users/mtkocak/Desktop/php-algorithms/src/Seekable.php=16d19848e3d772b52bd6a2b096f2cdd4 16 | /Users/mtkocak/Desktop/php-data-structures/tests/DoubleLinkedListTest.php=d443a61e91c5034f7c0f04d930ab860d 17 | /Users/mtkocak/Desktop/php-algorithms/src/BinarySearchTreeNode.php=63e892599253ff5959b8fa0cfbeb4452 18 | /Users/mtkocak/Desktop/php-data-structures/src/BinaryTree.php=ebd64951115d245c84dfa09ff6e8bf9c 19 | /Users/mtkocak/Desktop/php-data-structures/src/Graph.php=39380fb5b78975a180c1b6527ffec9fe 20 | /Users/mtkocak/Desktop/php-data-structures/src/DoubleLinkedListNode.php=096e6b848beb358b57345fac3473d8bb 21 | /Users/mtkocak/Desktop/php-algorithms/tests/QueueTest.php=ce31b03741e688b52c590f1f1a2481f9 22 | /Users/mtkocak/Desktop/php-algorithms/src/TreeNode.php=869577b13f2772c35f3ac671bae1da97 23 | /Users/mtkocak/Desktop/php-data-structures/src/Heap.php=e09ef7d793e45c97b3bead1aef142cf4 24 | /Users/mtkocak/Desktop/php-algorithms/src/Accessable.php=3a602c1b9da3350a0b60f7dce7d8e0ed 25 | /Users/mtkocak/Desktop/php-data-structures/src/DirectedGraph.php=39380fb5b78975a180c1b6527ffec9fe 26 | /Users/mtkocak/Desktop/php-algorithms/tests/TreeTest.php=63aabaa0cfc4beee74afa1f9f15b8a59 27 | /Users/mtkocak/Desktop/php-algorithms/src/Iterator.php=29528ab3c3218217a3c98675c8324cb7 28 | /Users/mtkocak/Desktop/php-algorithms/src/Stack.php=254c2b9df2d59e4234492c4308396d23 29 | /Users/mtkocak/Desktop/php-data-structures/src/TreeInterface.php=79737fa5573d93060799c883ab28fa46 30 | /Users/mtkocak/Desktop/php-algorithms/src/Searchable.php=f5feb85ffd425c94f8f6eb8140eca8aa 31 | /Users/mtkocak/Desktop/php-data-structures/src/Listable.php=abab88a1bed25a04c58378d2ad839a06 32 | /Users/mtkocak/Desktop/php-algorithms/tests/SingleLinkedListTest.php=d8502c3fcb4bf5f15cac35d9da6eebcb 33 | /Users/mtkocak/Desktop/php-data-structures/tests/SortableTest.php=40eeb8ec241ea38945db923e3dcf5486 34 | /Users/mtkocak/Desktop/php-data-structures/src/Searchable.php=8cfb090ed19c78e4c1350d52e775c371 35 | /Users/mtkocak/Desktop/php-data-structures/tests/BinarySearchTreeTest.php=d87713830d7734a080ebcd0beb8b188f 36 | /Users/mtkocak/Desktop/php-algorithms/src/SingleLinkedList.php=11bfd9afc33bb11742f4b48d903828af 37 | /Users/mtkocak/Desktop/php-algorithms/tests/AlgorithmsTest.php=aded56dc1cb90d37e18ba044441c36c3 38 | /Users/mtkocak/Desktop/php-algorithms/src/DataStructureNodeInterface.php=d06d24fe6357e9a1f9607a10bae3e47c 39 | /Users/mtkocak/Desktop/php-data-structures/src/BasicGraph.php=86a2ba3542b850b0c887d9a045fd7b37 40 | /Users/mtkocak/Desktop/php-data-structures/src/BinarySearchTreeNode.php=f9abf236e97a2a50d8be8ed874e788a0 41 | /Users/mtkocak/Desktop/php-algorithms/src/Queue.php=41f59a3eae7a53bee543968225b49af5 42 | /Users/mtkocak/Desktop/php-data-structures/src/Traversable.php=ba9750cf6482692ec220b48c1a9e4788 43 | /Users/mtkocak/Desktop/php-algorithms/tests/DoubleLinkedListTest.php=322a8cfee0b39feaca478e7851d2cb65 44 | /Users/mtkocak/Desktop/php-data-structures/src/Sortable.php=705d88ec7428d339887450cf4f809952 45 | /Users/mtkocak/Desktop/php-algorithms/src/LinkedList.php=391b24f54816f11ec57e03a3573faa5d 46 | /Users/mtkocak/Desktop/php-data-structures/src/BasicVertex.php=10010dd9310ac184dfd6e307d85b80e0 47 | /Users/mtkocak/Desktop/php-algorithms/src/DataStructureInterface.php=9b373fb66b4c6437deee972ad9d4356e 48 | /Users/mtkocak/Desktop/php-algorithms/src/SingleLinkedListNode.php=106a22fa3bf7ea8f4e7a2ab36b3517b8 49 | /Users/mtkocak/Desktop/php-data-structures/src/LinkedList.php=1b450005c57b394433be9046bac43b17 50 | /Users/mtkocak/Desktop/php-data-structures/src/SingleLinkedList.php=a4fe8e67a4e62dadb0f8614845eef073 51 | /Users/mtkocak/Desktop/php-algorithms/src/SingleLinkedList.php.bak.php=11288a4bf8d8351d57f0c1f142e32fb4 52 | /Users/mtkocak/Desktop/php-data-structures/src/DataStructureNode.php=64a1640baf407603f63d0938b43d07ff 53 | /Users/mtkocak/Desktop/php-algorithms/src/CircularLinkedListNode.php=39d09cdd2284d275fa2a7803e9928b63 54 | /Users/mtkocak/Desktop/php-algorithms/src/DoubleLinkedList.php=5db1fcc4f3fd77fa63f7af4650975eb0 55 | /Users/mtkocak/Desktop/php-algorithms/src/DataStructureNode.php=e16bfe9259bd89a359dfeb29d55a8c00 56 | /Users/mtkocak/Desktop/php-data-structures/tests/StackTest.php=dff4fc93be32261ac61c038f373e49bb 57 | /Users/mtkocak/Desktop/php-data-structures/src/Vertex.php=ebcee667c4e4b2ef0a187d5a911d2b45 58 | /Users/mtkocak/Desktop/php-algorithms/src/BinarySearchTree.php=a1450960ba284a4ca67ae8a9ec47e700 59 | /Users/mtkocak/Desktop/php-data-structures/tests/QueueTest.php=d515259361c81d9655c2f9bc8d8e9bed 60 | /Users/mtkocak/Desktop/php-algorithms/src/DoubleLinkedListNode.php=2ab574d59d997f998ade7e640083d615 61 | /Users/mtkocak/Desktop/php-algorithms/src/Algorithms.php=410e8af70ae2a52003f490b337d9669b 62 | /Users/mtkocak/Desktop/php-algorithms/src/Listable.php=abab88a1bed25a04c58378d2ad839a06 63 | /Users/mtkocak/Desktop/php-data-structures/src/DataStructure.php=a9d9500abcf8778e523ccaae80ae8683 64 | /Users/mtkocak/Desktop/php-algorithms/src/DoubleLinkedList.php.bak.php=7406d5a7a9a38137cdecf5b1703cd48f 65 | /Users/mtkocak/Desktop/php-data-structures/src/DirectedVertex.php=6ffe1537e1cec5224a4448a2a56e0148 66 | /Users/mtkocak/Desktop/php-data-structures/src/Stack.php=817585bee210fa7ac3b9651e586a0e25 67 | /Users/mtkocak/Desktop/php-algorithms/src/Traversable.php=d04ff2184d23de295225a722eec85613 68 | /Users/mtkocak/Desktop/php-data-structures/src/DoubleLinkedList.php=0a9d13e51ccbb0c89a829b2a733fbe13 69 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { "name": "mtkocak/algorithms", 2 | "description": "Midori PHP Algorithms and Data Structures", 3 | "license": "MIT", 4 | "keywords": ["algorithms","data structures", "open", "source"], 5 | "authors": [ 6 | { 7 | "name": "Midori Kocak", 8 | "email": "mtkocak@gmail.com" 9 | } 10 | ], 11 | "require": {}, 12 | "require-dev": { 13 | "squizlabs/php_codesniffer": "2.*", 14 | "phpmd/phpmd": "2.1.*", 15 | "sebastian/phpcpd": "2.0.*", 16 | "pdepend/pdepend": "2.0.*", 17 | "phploc/phploc": "2.0.*", 18 | "phpunit/phpunit": "4.3.*", 19 | "theseer/phpdox": "0.7.*" 20 | }, 21 | "config": { 22 | "bin-dir": "bin/", 23 | "preferred-install": "dist" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "Mtkocak\\DataStructures\\": "src" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /opensource-checklist.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: base 3 | title: "Open Source Checklist" 4 | --- 5 | 6 | # Open Source Check List 7 | 8 | Prior to releasing a project to GitHub.com, walk through these items and ensure they are addressed. 9 | 10 | - **Has PII been removed?** 11 | - Use [Clouseau](https://github.com/virtix/clouseau) for scanning source code. 12 | - For an Open Source Release, attach the Clouseau output. 13 | - If there are images, visually inspect each image to ensure there is no CFPB-specific information. 14 | 15 | - **Have security vulnerabilities been remediated?** 16 | - Use the [OWASP Top 10](https://www.owasp.org/index.php/Top_10_2013) 17 | - [National Vulnerability Database](http://nvd.nist.gov/) 18 | - [SANS Swat Checklist](http://www.securingthehuman.org/developer/swat) 19 | 20 | - **Are we including any other open source products? If so, is there any conflict with our public domain release?** 21 | 22 | - **Is our `TERMS.md` included?** 23 | 24 | - **Is a `CHANGELOG.md` present and does it contain structured, consistently formatted recent history?** 25 | - See and 26 | - Some Inspiration: 27 | 28 | - **Are instructions for contributing included (`CONTRIBUTING.md`)?** 29 | 30 | - **Are installation instructions clearly written in the `README` _and_ tested on a clean machine?** 31 | 32 | - **Are all dependencies described in the `README`, `requirements.txt`, and/or `buildout.cfg`?** 33 | 34 | - **Are the API docs generated?** 35 | 36 | - **Are there unit tests?** 37 | 38 | - **If appplicable and possible, is it set up in TravisCI?** 39 | 40 | - **Have multiple people reviewed the code?** 41 | 42 | - **Is there a screenshot in the `README`, if applicable?** 43 | 44 | 45 | ## Copy this version to paste into a GitHub issue with live checkboxes: 46 | 47 | ~~~ 48 | - [ ] **Has PII been removed?** 49 | - Use [Clouseau](https://github.com/virtix/clouseau) for scanning source code. 50 | - If there are images, visually inspect each image to ensure there is no CFPB-specific information. 51 | - [ ] **Have security vulnerabilities been remediated?** 52 | - [ ] **Are we including any other open source products? If so, is there any conflict with our public domain release?** 53 | - [ ] **Is our `TERMS.md` included?** 54 | - [ ] **Is a `CHANGELOG.md` present and does it contain structured, consistently formatted recent history?** 55 | - [ ] **Are instructions for contributing included (`CONTRIBUTING.md`)?** 56 | - [ ] **Are installation instructions clearly written in the `README` _and_ tested on a clean machine?** 57 | - [ ] **Are all dependencies described in the `README`, `requirements.txt`, and/or `buildout.cfg`?** 58 | - [ ] **Are the API docs generated?** 59 | - [ ] **Are there unit tests?** 60 | - [ ] **If applicable and possible, is it set up in TravisCI?** 61 | - [ ] **Have multiple people reviewed the code?** 62 | - [ ] **Is there a screenshot in the `README`, if applicable?** 63 | ~~~ 64 | 65 | ---- 66 | 67 | 68 | ## Take a look at the following projects as good models to follow: 69 | 70 | - [https://github.com/cfpb/qu](https://github.com/cfpb/qu) 71 | - [https://github.com/cfpb/idea-box](https://github.com/cfpb/idea-box) 72 | - [https://github.com/cfpb/hmda-tool](https://github.com/cfpb/hmda-tools) 73 | - [https://github.com/cfpb/django-cache-tools](https://github.com/cfpb/django-cache-tools) 74 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/midorikocak/algorithms-and-data-structures/3422ae20f97ba414814544de08d3335ca80db76c/screenshot.png -------------------------------------------------------------------------------- /src/BasicGraph.php: -------------------------------------------------------------------------------- 1 | isEmpty()) { 11 | $current = $this->root(); 12 | while ($current) { 13 | if ($value < $current->get()) { 14 | if ($current->left() == NULL) { 15 | $current->left($newNode); 16 | return true; 17 | } else { 18 | $current = $current->left(); 19 | } 20 | } elseif ($value > $current->get()) { 21 | if ($current->right() == NULL) { 22 | $current->right($newNode); 23 | return true; 24 | } else { 25 | $current = $current->right(); 26 | } 27 | } else { 28 | return false; 29 | } 30 | } 31 | } else { 32 | $this->root($newNode); 33 | return true; 34 | } 35 | return false; 36 | } 37 | 38 | /** 39 | * Check if is a valid Binary Search Tree 40 | * 41 | * @return boolean 42 | */ 43 | public function validate() 44 | { 45 | return false; 46 | } 47 | 48 | public function delete(TreeNodeInterface $node) 49 | { 50 | if ($node->left() == NULL && $node->right() == NULL) { 51 | $node = NULL; 52 | } elseif ($node->left() != NULL && $node->right() == NULL) { 53 | $node = $node->left(); 54 | } elseif ($node->left() == NULL && $node->right() != NULL) { 55 | $nodeToDelete = $node; 56 | $node = $node->right(); 57 | unset($nodeToDelete); 58 | } else { 59 | $predecessor = $this->predecessor($node); 60 | $successor = $this->successor($node); 61 | if ($predecessor != NULL && $predecessor != false) { 62 | $node = $predecessor; 63 | } elseif ($successor != NULL && $successor != false) { 64 | $node = $successor; 65 | } 66 | } 67 | } 68 | 69 | public function deleteValue($value) 70 | { 71 | $current = $this->root(); 72 | $parent = NULL; 73 | $direction = NULL; 74 | while($current){ 75 | if ($value < $current->get()) { 76 | if ($current->left() != NULL) { 77 | $parent = $current; 78 | $direction = 'left'; 79 | $current = $current->left(); 80 | } else { 81 | return false; 82 | } 83 | } elseif ($value > $current->get()) { 84 | if ($current->right() != NULL) { 85 | $parent = $current; 86 | $direction = 'right'; 87 | $current = $current->right(); 88 | } else { 89 | return false; 90 | } 91 | } else { 92 | if($current->left()==NULL && $current->right()==NULL){ 93 | if($direction=='right'){ 94 | $parent->right = NULL; 95 | } 96 | if($direction=='left'){ 97 | $parent->left = NULL; 98 | } 99 | }elseif($current->left()!=NULL && $current->right()==NULL){ 100 | if($direction=='right'){ 101 | $parent->right = $current->left(); 102 | } 103 | if($direction=='left'){ 104 | $parent->left = $current->left(); 105 | } 106 | }elseif($current->left()==NULL && $current->right()!=NULL){ 107 | if($direction=='right'){ 108 | $parent->right = $current->right(); 109 | } 110 | if($direction=='left'){ 111 | $parent->left = $current->right(); 112 | } 113 | } 114 | elseif($current->left()!=NULL && $current->right()!=NULL){ 115 | if($direction=='right'){ 116 | $parent->right = $current->right(); 117 | } 118 | if($direction=='left'){ 119 | $parent->left = $current->left(); 120 | } 121 | 122 | $predecessor = $this->predecessor($current); 123 | $successor = $this->successor($current); 124 | if ($predecessor != NULL && $predecessor != false) { 125 | $current = $predecessor; 126 | } elseif ($successor != NULL && $successor != false) { 127 | $current = $successor; 128 | } 129 | 130 | } 131 | return true; 132 | } 133 | } 134 | return false; 135 | } 136 | 137 | public function search($value) 138 | { 139 | $current = $this->root(); 140 | while ($current) { 141 | if ($value < $current->get()) { 142 | if ($current->left() != NULL) { 143 | $current = $current->left(); 144 | } else { 145 | return false; 146 | } 147 | } elseif ($value > $current->get()) { 148 | if ($current->right() != NULL) { 149 | $current = $current->right(); 150 | } else { 151 | return false; 152 | } 153 | } else { 154 | return true; 155 | } 156 | } 157 | return false; 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /src/BinarySearchTreeNode.php: -------------------------------------------------------------------------------- 1 | data != NULL) { 11 | if ($this->left() != NULL && $this->left() > $this->get()) { 12 | return false; 13 | } 14 | if ($this->right() != NULL < $this->get()) { 15 | return false; 16 | } 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/BinaryTree.php: -------------------------------------------------------------------------------- 1 | root != NULL) { 15 | throw new Exception("Node Not Empty"); 16 | } else { 17 | $this->root = $node; 18 | } 19 | } else { 20 | return $this->root; 21 | } 22 | } 23 | 24 | function __construct() 25 | { 26 | $this->root = NULL; 27 | } 28 | 29 | abstract public function add($value); 30 | 31 | abstract public function delete(TreeNodeInterface $node); 32 | 33 | /** 34 | * 35 | * @param DataStructureNode $node 36 | * @return boolean|unknown 37 | */ 38 | public function predecessor(TreeNodeInterface $node) 39 | { 40 | // Go Left and after right most element 41 | if ($node->left() == NULL) { 42 | return false; 43 | } else { 44 | $current = $node->left(); 45 | while ($current) { 46 | if ($current->right() == NULL) { 47 | return $current; 48 | } 49 | $current = $current->right(); 50 | } 51 | } 52 | return false; 53 | } 54 | 55 | public function successor(TreeNodeInterface $node) 56 | { 57 | // Go right and after left most element 58 | if ($node->right() == NULL) { 59 | return false; 60 | } else { 61 | $current = $node->right(); 62 | while ($current) { 63 | if ($current->left() == NULL) { 64 | return $current; 65 | } 66 | $current = $current->left(); 67 | } 68 | } 69 | return false; 70 | } 71 | 72 | public function isEmpty() 73 | { 74 | if ($this->root == NULL) { 75 | return true; 76 | } else { 77 | return false; 78 | } 79 | } 80 | 81 | abstract public function search($value); 82 | 83 | public function breadthFirst(TreeNodeInterface $node = null) 84 | { 85 | $queue = new Queue(); 86 | 87 | $queue->enqueue($this->root); 88 | 89 | $listToReturn = []; 90 | 91 | while (! $queue->isEmpty()) { 92 | $dequeue = $queue->dequeue(); 93 | if ($dequeue->left != NULL) { 94 | $queue->enqueue($dequeue->left); 95 | } 96 | if ($dequeue->right != NULL) { 97 | $queue->enqueue($dequeue->right); 98 | } 99 | array_push($listToReturn, $dequeue->get()); 100 | } 101 | return $listToReturn; 102 | } 103 | 104 | // preorder postorder and inorder functions are using function call stack due to being recursive 105 | public function depthFirsth(TreeNodeInterface $node = null, $mode) 106 | { 107 | if (! isset($node)) { 108 | $node = $this->root(); 109 | } 110 | // uses a Stack 111 | $listArray = []; 112 | $stack = new Stack(); 113 | switch ($mode) { 114 | case 'postOrder': 115 | $current = $node; 116 | while (! $stack->isEmpty()) { 117 | $stack->push($current); 118 | if ($current->left() == null && $current->right() == null) { 119 | array_push($listArray, $current->get()); 120 | $stack->pop(); 121 | } elseif ($current->left() != null) { 122 | $stack->push($current->left()); 123 | array_push($listArray, $current->left->get()); 124 | $current = $current->left(); 125 | } elseif ($current->right != null) { 126 | $stack->push($current->right()); 127 | array_push($listArray, $current->right->get()); 128 | $current = $current->right(); 129 | } 130 | $stack->pop(); 131 | } 132 | break; 133 | case 'inOrder': 134 | array_push($listArray, $node->readNode()); 135 | while (! $stack->isEmpty()) {} 136 | break; 137 | case 'preOrder': 138 | while (! $stack->isEmpty()) {} 139 | break; 140 | } 141 | return $listArray; 142 | } 143 | 144 | public function inOrder(TreeNodeInterface $node = null) 145 | { 146 | if (! isset($node)) { 147 | $node = $this->root(); 148 | } 149 | $listArray = []; 150 | if (! $this->isEmpty()) { 151 | if ($node->left() != null) { 152 | $listArray = array_merge($listArray, $this->inOrder($node->left())); 153 | } 154 | array_push($listArray, $node->get()); 155 | if ($node->right() != null) { 156 | $listArray = array_merge($listArray, $this->inOrder($node->right())); 157 | } 158 | } 159 | // first print left, recursive 160 | return $listArray; 161 | } 162 | 163 | public function postOrder(TreeNodeInterface $node = null) 164 | 165 | // first print self, recursive 166 | { 167 | if (! isset($node)) { 168 | $node = $this->root(); 169 | } 170 | $listArray = []; 171 | if (! $this->isEmpty()) { 172 | if ($node->left() != null) { 173 | array_push($listArray, $this->postOrder($node->left())); 174 | } 175 | if ($node->right() != null) { 176 | array_push($listArray, $this->postOrder($node->right())); 177 | } 178 | array_push($listArray, $node->get()); 179 | } 180 | return $listArray; 181 | } 182 | 183 | public function preOrder(TreeNodeInterface $node = null) 184 | { 185 | // first print right, recursive 186 | if (! isset($node)) { 187 | $node = $this->root(); 188 | } 189 | $listArray = []; 190 | array_push($listArray, $node->get()); 191 | if (! $this->isEmpty()) { 192 | if ($node->left() != null) { 193 | array_push($listArray, $this->preOrder($node->left())); 194 | } 195 | if ($node->right() != null) { 196 | array_push($listArray, $this->preOrder($node->right())); 197 | } 198 | } 199 | return $listArray; 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /src/BinaryTreeNode.php: -------------------------------------------------------------------------------- 1 | data = $data; 18 | $this->left = NULL; 19 | $this->right = NULL; 20 | } 21 | 22 | public function left(TreeNodeInterface &$node = NULL) 23 | { 24 | if (isset($node)) { 25 | if ($this->left != NULL) { 26 | throw new Exception("Node Not Empty"); 27 | } else { 28 | $this->left = $node; 29 | } 30 | } 31 | return $this->left; 32 | } 33 | 34 | public function right(TreeNodeInterface &$node = NULL) 35 | { 36 | if (isset($node)) { 37 | if ($this->right != NULL) { 38 | throw new Exception("Node Not Empty"); 39 | } else { 40 | $this->right = $node; 41 | } 42 | } 43 | return $this->right; 44 | } 45 | 46 | public function get() 47 | { 48 | return $this->data; 49 | } 50 | 51 | public function set($value) 52 | { 53 | $this->data = $value; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/DataStructure.php: -------------------------------------------------------------------------------- 1 | isEmpty()){ 10 | $this->bottom($newNode); 11 | $this->top($newNode); 12 | } 13 | else{ 14 | $oldTop = $this->top; 15 | $oldTop->next($newNode); 16 | $newNode->prev($oldTop); 17 | $this->top($newNode); 18 | } 19 | $this->count++; 20 | } 21 | 22 | /** 23 | * Deletes from end, and returns value. 24 | */ 25 | public function pop(){ 26 | if(!$this->isEmpty()){ 27 | $this->rewind(); 28 | 29 | $nodeToDelete = $this->top; 30 | $value = $nodeToDelete->get(); 31 | $this->top($nodeToDelete->prev()); 32 | $this->top->next = NULL; 33 | 34 | unset($nodeToDelete); 35 | 36 | return $value; 37 | } 38 | return false; 39 | } 40 | 41 | /** 42 | * Add to beginning. Reverse of push(); 43 | */ 44 | public function add($value){ 45 | $newNode = new DoubleLinkedListNode($value); 46 | 47 | if($this->isEmpty()){ 48 | $this->bottom = $newNode; 49 | $this->top = $newNode; 50 | $this->count++; 51 | return true; 52 | } 53 | else{ 54 | $currentBottom = $this->bottom; 55 | $currentBottom->prev($newNode); 56 | $this->bottom = &$newNode; 57 | $this->bottom->next($currentBottom); 58 | $this->count++; 59 | return true; 60 | } 61 | return false; 62 | } 63 | 64 | public function insertAfter($key, $value){ 65 | $newNode = new DoubleLinkedListNode($value); 66 | $this->rewind(); 67 | $currentKey = 0; 68 | while($this->current){ 69 | if($currentKey==$key){ 70 | $next = $this->current->next(); 71 | $next->prev($newNode); 72 | $this->current->next($newNode); 73 | $newNode->next($next); 74 | return true; 75 | } 76 | $this->next(); 77 | $currentKey++; 78 | } 79 | return false; 80 | } 81 | 82 | public function insertBefore($key, $value){ 83 | $newNode = new DoubleLinkedListNode($value); 84 | $this->rewind(); 85 | $currentKey = 0; 86 | while($this->current){ 87 | if($currentKey==$key){ 88 | $prev = $this->current->prev(); 89 | $prev->next($newNode); 90 | $this->current->prev($newNode); 91 | $newNode->prev($prev); 92 | return true; 93 | } 94 | $this->next(); 95 | $currentKey++; 96 | } 97 | return false; 98 | } 99 | 100 | public function offsetUnset( $offset ){ 101 | $counter = 0; 102 | $current = $this->bottom; 103 | while($current){ 104 | if($counter == $offset){ 105 | $next = $current->next(); 106 | $prev = $current->prev(); 107 | 108 | if($this->count()==1){ 109 | $this->top = NULL; 110 | $this->bottom = NULL; 111 | }elseif($counter == $this->count()){ 112 | $this->top = $prev; 113 | }else{ 114 | $prev->next($next); 115 | $next->prev($prev); 116 | } 117 | $current = NULL; 118 | return true; 119 | } 120 | $counter++; 121 | $current = $current->next(); 122 | } 123 | throw new \OutOfBoundsException(); 124 | } 125 | 126 | /** 127 | * Delete from beginning. Reverse of pop(); 128 | */ 129 | public function delete(){ 130 | if(!$this->isEmpty()){ 131 | $nodeToDelete = $this->bottom; 132 | $value = $nodeToDelete->get(); 133 | $newBottom = $nodeToDelete->next(); 134 | if($newBottom!=NULL){ 135 | $newBottom->prev = NULL; 136 | } 137 | $this->bottom = $newBottom; 138 | if($this->isEmpty()){ 139 | $this->top = NULL; 140 | } 141 | return $value; 142 | } 143 | return false; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/DoubleLinkedListNode.php: -------------------------------------------------------------------------------- 1 | data = $data; 15 | $this->next = NULL; 16 | $this->prev = NULL; 17 | } 18 | 19 | public function get() 20 | { 21 | return $this->data; 22 | } 23 | 24 | public function set($value) 25 | { 26 | $this->data = $value; 27 | return $this->data; 28 | } 29 | 30 | public function next(DataStructureNode $node = NULL) 31 | { 32 | if(isset($node)) 33 | { 34 | $this->next = $node; 35 | } 36 | return $this->next; 37 | } 38 | 39 | public function prev(DataStructureNode $node = NULL) 40 | { 41 | if(isset($node)) 42 | { 43 | $this->prev = $node; 44 | } 45 | return $this->prev; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Graph.php: -------------------------------------------------------------------------------- 1 | findFirstAvaliableNode(); 13 | $nodeToAdd = new BinaryTreeNode($value); 14 | 15 | if($nodeToAttach->left == NULL){ 16 | $nodeToAttach->left($nodeToAdd); 17 | }elseif($nodeToAttach->right == NULL){ 18 | $nodeToAttach->right($nodeToAdd); 19 | } 20 | 21 | // Heapify 22 | if($nodeToAttach->get()<$nodeToAdd->get()){ 23 | // parent node? 24 | } 25 | } 26 | 27 | /* 28 | * (non-PHPdoc) 29 | * @see \Mtkocak\DataStructures\BinaryTree::delete() 30 | */ 31 | public function delete(\Mtkocak\DataStructures\TreeNodeInterface $node) 32 | { 33 | // TODO Auto-generated method stub 34 | } 35 | 36 | /* 37 | * (non-PHPdoc) 38 | * @see \Mtkocak\DataStructures\BinaryTree::search() 39 | */ 40 | public function search($value) 41 | { 42 | // TODO Auto-generated method stub 43 | } 44 | 45 | 46 | 47 | /** 48 | * 49 | * Similar to bredth first traversal 50 | * 51 | * @return Ambigous 52 | */ 53 | public function findFirstAvaliableNode() 54 | { 55 | $queue = new Queue(); 56 | 57 | $queue->enqueue($this->root); 58 | while (! $queue->isEmpty()) { 59 | $dequeue = $queue->dequeue(); 60 | if ($dequeue->left != NULL) { 61 | $queue->enqueue($dequeue->left); 62 | } else { 63 | return dequeue; 64 | } 65 | if ($dequeue->right != NULL) { 66 | $queue->enqueue($dequeue->right); 67 | } else { 68 | return dequeue; 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/LinkedList.php: -------------------------------------------------------------------------------- 1 | top = NULL; 30 | $this->bottom = NULL; 31 | $this->current = $this->bottom; 32 | $this->key = 0; 33 | $this->count = $this->count(); 34 | } 35 | 36 | public function top(DataStructureNode $node = NULL) 37 | { 38 | if (isset($node)) { 39 | $this->top = $node; 40 | } 41 | return $this->top->get(); 42 | } 43 | 44 | public function valid(){ 45 | return $this->offsetExists($this->key); 46 | } 47 | 48 | 49 | public function offsetExists( $offset ){ 50 | $counter = 0; 51 | $current = $this->bottom; 52 | while($current){ 53 | if($counter == $offset){ 54 | return true; 55 | } 56 | $counter++; 57 | $current = $current->next(); 58 | } 59 | return false; 60 | } 61 | 62 | public function offsetGet( $offset ){ 63 | $counter = 0; 64 | $current = $this->bottom; 65 | while($current){ 66 | if($counter == $offset){ 67 | return $current->get(); 68 | } 69 | $counter++; 70 | $current = $current->next(); 71 | } 72 | throw new \OutOfBoundsException(); 73 | } 74 | public function offsetSet( $offset , $value ){ 75 | $counter = 0; 76 | $current = $this->bottom; 77 | while($current){ 78 | if($counter == $offset){ 79 | $current->set($value); 80 | return true; 81 | } 82 | $counter++; 83 | $current = $current->next(); 84 | } 85 | throw new \OutOfBoundsException(); 86 | } 87 | abstract public function offsetUnset( $offset ); 88 | 89 | public function bottom(DataStructureNode $node = NULL) 90 | { 91 | if (isset($node)) { 92 | $this->bottom = $node; 93 | } 94 | return $this->bottom->get(); 95 | } 96 | 97 | public function current() 98 | { 99 | return $this->current->get(); 100 | } 101 | 102 | public function next() 103 | { 104 | $this->key++; 105 | $this->current = $this->current->next(); 106 | } 107 | 108 | public function prev() 109 | { 110 | $this->key--; 111 | $this->current = $this->current->prev(); 112 | } 113 | 114 | public function rewind() 115 | { 116 | $this->key = 0; 117 | $this->current = $this->bottom; 118 | } 119 | 120 | public function count() 121 | { 122 | if ($this->count == NULL) { 123 | $this->rewind(); 124 | $count = 0; 125 | while ($this->current) { 126 | $count ++; 127 | $current = $current->next; 128 | } 129 | $this->count = $count; 130 | } else { 131 | return $this->count; 132 | } 133 | } 134 | 135 | public function listAll(DataStructureNode $node = NULL) 136 | { 137 | $listArray = []; 138 | if ($node == NULL) { 139 | $node = $this->bottom; 140 | } 141 | if (! $this->isEmpty()) { 142 | while ($node) { 143 | array_push($listArray, $node->get()); 144 | $node = $node->next(); 145 | } 146 | } 147 | return $listArray; 148 | } 149 | 150 | abstract public function push($value); 151 | 152 | public function key() 153 | { 154 | return $this->key; 155 | } 156 | 157 | abstract public function pop(); 158 | 159 | /** 160 | * Add to beginning. 161 | * Reverse of push(); 162 | */ 163 | abstract public function add($value); 164 | 165 | abstract public function insertAfter($key, $value); 166 | 167 | abstract public function insertBefore($key, $value); 168 | 169 | /** 170 | * Delete from beginning. 171 | * Reverse of pop(); 172 | */ 173 | abstract public function delete(); 174 | 175 | public function isEmpty() 176 | { 177 | if ($this->bottom == NULL) { 178 | return true; 179 | } else { 180 | return false; 181 | } 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/Listable.php: -------------------------------------------------------------------------------- 1 | head = NULL; 10 | $this->tail = NULL; 11 | } 12 | 13 | public function enqueue($value){ 14 | $newNode = new SingleLinkedListNode($value); 15 | if($this->isEmpty()) 16 | { 17 | $this->head = $newNode; 18 | $this->tail = $newNode; 19 | }else{ 20 | $currentTail = $this->tail; 21 | $newNode->next($currentTail); 22 | $this->tail = $newNode; 23 | } 24 | } 25 | 26 | public function dequeue(){ 27 | $current = $this->tail; 28 | if($current == $this->head){ 29 | $this->tail = NULL; 30 | $this->head = NULL; 31 | return $current->get(); 32 | } 33 | while($current){ 34 | if($current->next() == $this->head){ 35 | $nodeToDelete = $this->head; 36 | $this->head = $current; 37 | $current->next = NULL; 38 | return $nodeToDelete->get(); 39 | } 40 | $current = $current->next(); 41 | } 42 | return false; 43 | } 44 | 45 | public function listAll(){ 46 | $current = $this->tail; 47 | $listToReturn = []; 48 | while($current){ 49 | array_push($listToReturn, $current->get()->get()); 50 | $current = $current->next(); 51 | } 52 | return $listToReturn; 53 | } 54 | 55 | public function peek(){ 56 | return $this->head->get(); 57 | } 58 | 59 | public function isEmpty(){ 60 | if($this->head == NULL){ 61 | return true; 62 | } 63 | else{ 64 | return false; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Searchable.php: -------------------------------------------------------------------------------- 1 | isEmpty()){ 10 | $this->bottom($newNode); 11 | $this->top($newNode); 12 | } 13 | else{ 14 | $this->top->next($newNode); 15 | $this->top($newNode); 16 | } 17 | $this->count++; 18 | } 19 | 20 | /** 21 | * Deletes from end, and returns value. 22 | */ 23 | public function pop(){ 24 | $this->rewind(); 25 | $value = NULL; 26 | if(!$this->isEmpty()){ 27 | if($this->current->next()==NULL){ 28 | $nodeToDelete = $this->current; 29 | $value = $nodeToDelete->get(); 30 | $this->top(NULL); 31 | $this->bottom(NULL); 32 | unset($nodeToDelete); 33 | return $value; 34 | } 35 | while($this->current->next()!=NULL) 36 | { 37 | if($this->current->next()->next() == NULL){ 38 | $nextToDelete = $this->current->next(); 39 | $value = $nextToDelete->get(); 40 | unset($nextToDelete); 41 | $this->top($this->current); 42 | $this->current->next(NULL); 43 | } 44 | 45 | $this->next(); 46 | } 47 | return $value; 48 | } 49 | return false; 50 | } 51 | 52 | /** 53 | * Add to beginning. Reverse of push(); 54 | */ 55 | public function add($value){ 56 | $newNode = new SingleLinkedListNode($value); 57 | 58 | if($this->isEmpty()){ 59 | $this->bottom = $newNode; 60 | $this->top = $newNode; 61 | $this->count++; 62 | return true; 63 | } 64 | else{ 65 | $currentBottom = $this->bottom; 66 | $this->bottom = &$newNode; 67 | $this->bottom->next($currentBottom); 68 | $this->count++; 69 | return true; 70 | } 71 | return false; 72 | } 73 | 74 | public function insertAfter($key, $value){ 75 | $newNode = new SingleLinkedListNode($value); 76 | $this->rewind(); 77 | $currentKey = 0; 78 | while($this->current){ 79 | if($currentKey==$key){ 80 | $next = $this->current->next(); 81 | $this->current->next($newNode); 82 | $newNode->next($next); 83 | return true; 84 | } 85 | $this->next(); 86 | $currentKey++; 87 | } 88 | return false; 89 | } 90 | 91 | public function insertBefore($key, $value){ 92 | $newNode = new SingleLinkedListNode($value); 93 | $this->rewind(); 94 | $currentKey = 0; 95 | while($this->current && $currentKey!=$key){ 96 | if(($currentKey+1)==$key){ 97 | $nodeToInsertBefore = $this->current->next(); 98 | $this->current->next($newNode); 99 | $newNode->next($nodeToInsertBefore); 100 | return true; 101 | } 102 | $this->next(); 103 | $currentKey++; 104 | } 105 | return false; 106 | } 107 | 108 | public function offsetUnset( $offset ){ 109 | // $counter = 0; 110 | // $current = $this->bottom; 111 | // while($current){ 112 | // $counter++; 113 | // $current = $current->next(); 114 | // } 115 | // if($counter == $offset){ 116 | // $next = $current->next(); 117 | // 118 | // if($this->count()==1){ 119 | // $this->top = NULL; 120 | // $this->bottom = NULL; 121 | // }elseif($counter == $this->count()){ 122 | // $this->top = $prev; 123 | // }else{ 124 | // $prev->next($next); 125 | // $next->prev($prev); 126 | // } 127 | // $current = NULL; 128 | // return true; 129 | // }else{ 130 | // return false; 131 | // } 132 | } 133 | 134 | /** 135 | * Delete from beginning. Reverse of pop(); 136 | */ 137 | public function delete(){ 138 | if(!$this->isEmpty()){ 139 | $nodeToDelete = $this->bottom; 140 | $value = $nodeToDelete->get(); 141 | $newBottom = $nodeToDelete->next(); 142 | $this->bottom($newBottom); 143 | return $value; 144 | } 145 | return false; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/SingleLinkedListNode.php: -------------------------------------------------------------------------------- 1 | data = $data; 12 | $this->next = NULL; 13 | } 14 | 15 | public function get() 16 | { 17 | return $this->data; 18 | } 19 | 20 | public function set($value) 21 | { 22 | $this->data = $value; 23 | return $this->data; 24 | } 25 | 26 | public function next(DataStructureNode $node = NULL) 27 | { 28 | if(isset($node)) 29 | { 30 | $this->next = $node; 31 | } 32 | return $this->next; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Stack.php: -------------------------------------------------------------------------------- 1 | top = NULL; 12 | $this->bottom = NULL; 13 | } 14 | 15 | public function isEmpty() 16 | { 17 | if ($this->top == NULL) { 18 | return true; 19 | } else { 20 | return false; 21 | } 22 | } 23 | 24 | public function push($value){ 25 | $newNode = new SingleLinkedListNode($value); 26 | if($this->isEmpty()){ 27 | $this->top = $newNode; 28 | $this->tbottom = $newNode; 29 | return true; 30 | }else{ 31 | $oldTop = $this->top; 32 | $this->top = $newNode; 33 | $newNode->next($oldTop); 34 | return true; 35 | } 36 | return false; 37 | } 38 | 39 | public function pop(){ 40 | if(!$this->isEmpty()){ 41 | $top = $this->top; 42 | $value = $top->get(); 43 | $this->top = $top->next(); 44 | unset($top); 45 | return $value; 46 | }else{ 47 | return false; 48 | } 49 | } 50 | 51 | public function peek(){ 52 | return $this->top->get(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Traversable.php: -------------------------------------------------------------------------------- 1 | binarySearchTree = new BinarySearchTree(); 14 | $this->values = [ 15 | 8, 16 | 5, 17 | 9, 18 | 7, 19 | 1, 20 | 12, 21 | 2, 22 | 10, 23 | 4, 24 | 11, 25 | 3 26 | ]; 27 | } 28 | 29 | public function generateData() 30 | { 31 | $data = md5(microtime()); 32 | return $data; 33 | } 34 | 35 | public function testAddDataWhenEmpty() 36 | { 37 | $this->binarySearchTree->add(1); 38 | $lastData = $this->binarySearchTree->root(); 39 | $this->assertTrue($lastData->get() == 1); 40 | } 41 | 42 | public function testCreateTree() 43 | { 44 | foreach ($this->values as $value) { 45 | $this->binarySearchTree->add($value); 46 | } 47 | // Sorts! 48 | $this->assertTrue(sort($this->values) == $this->binarySearchTree->inOrder()); 49 | } 50 | 51 | public function testSearchFound() 52 | { 53 | $this->testCreateTree(); 54 | $this->assertTrue($this->binarySearchTree->search(8) != false); 55 | } 56 | 57 | public function testDeleteOneNodeEmpty() 58 | { 59 | $this->testCreateTree(); 60 | $this->binarySearchTree->deleteValue(4); 61 | $values = [ 62 | 1, 63 | 2, 64 | 3, 65 | 5, 66 | 7, 67 | 8, 68 | 9, 69 | 10, 70 | 11, 71 | 12 72 | ]; 73 | $this->assertTrue($values == $this->binarySearchTree->inOrder()); 74 | } 75 | 76 | public function testDeleteTwoNodeEmpty() 77 | { 78 | $this->testCreateTree(); 79 | $this->binarySearchTree->deleteValue(7); 80 | $values = [ 81 | 1, 82 | 2, 83 | 3, 84 | 4, 85 | 5, 86 | 8, 87 | 9, 88 | 10, 89 | 11, 90 | 12 91 | ]; 92 | $this->assertTrue($values == $this->binarySearchTree->inOrder()); 93 | } 94 | 95 | public function testDeleteNoNodeEmpty() 96 | { 97 | $this->testCreateTree(); 98 | $this->binarySearchTree->deleteValue(5); 99 | $values = [ 100 | 1, 101 | 2, 102 | 3, 103 | 4, 104 | 8, 105 | 9, 106 | 10, 107 | 11, 108 | 12 109 | ]; 110 | $this->assertTrue($values == $this->binarySearchTree->inOrder()); 111 | } 112 | 113 | public function testSearchNotFound() 114 | { 115 | $this->testCreateTree(); 116 | $this->assertFalse($this->binarySearchTree->search(36)); 117 | } 118 | 119 | public function testBreadthFirst() 120 | { 121 | $this->testCreateTree(); 122 | $breadthFrist = [ 123 | 8, 124 | 5, 125 | 9, 126 | 1, 127 | 7, 128 | 12, 129 | 2, 130 | 10, 131 | 4, 132 | 11, 133 | 3 134 | ]; 135 | $this->assertEquals($breadthFrist, $this->binarySearchTree->breadthFirst()); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /tests/DoubleLinkedListTest.php: -------------------------------------------------------------------------------- 1 | doubleLinkedList = new DoubleLinkedList(); 12 | } 13 | 14 | public function generateData() 15 | { 16 | $data = md5(microtime()); 17 | return $data; 18 | } 19 | 20 | public function testAddData() 21 | { 22 | $data = $this->generateData(); 23 | $this->doubleLinkedList->push($data); 24 | $lastData = $this->doubleLinkedList->pop(); 25 | $this->assertTrue($data == $lastData); 26 | } 27 | 28 | public function testAddAnotherData() 29 | { 30 | $this->testAddData(); 31 | $anotherData = $this->generateData(); 32 | $this->doubleLinkedList->push($anotherData); 33 | $lastAnotherData = $this->doubleLinkedList->pop(); 34 | $this->assertTrue($anotherData == $lastAnotherData); 35 | } 36 | 37 | public function testListAll() 38 | { 39 | $firstData = $this->generateData(); 40 | $secondData = $this->generateData(); 41 | $this->doubleLinkedList->push($firstData); 42 | $this->doubleLinkedList->push($secondData); 43 | $dataArray = [ 44 | $firstData, 45 | $secondData 46 | ]; 47 | $this->assertTrue($this->doubleLinkedList->listAll() == $dataArray); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/QueueTest.php: -------------------------------------------------------------------------------- 1 | queue = new Queue(); 12 | } 13 | 14 | public function generateData() 15 | { 16 | $data = md5(microtime()); 17 | return $data; 18 | } 19 | 20 | public function testAddData() 21 | { 22 | $data = $this->generateData(); 23 | $this->queue->enqueue($data); 24 | $lastData = $this->queue->dequeue(); 25 | $this->assertTrue($data == $lastData); 26 | } 27 | 28 | public function testAddAnotherData() 29 | { 30 | $this->testAddData(); 31 | $anotherData = $this->generateData(); 32 | $this->queue->enqueue($anotherData); 33 | $lastAnotherData = $this->queue->dequeue(); 34 | $this->assertTrue($anotherData == $lastAnotherData); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/SingleLinkedListTest.php: -------------------------------------------------------------------------------- 1 | singleLinkedList = new SingleLinkedList(); 12 | } 13 | 14 | public function generateData() 15 | { 16 | $data = md5(microtime()); 17 | return $data; 18 | } 19 | 20 | public function testAddData() 21 | { 22 | $data = $this->generateData(); 23 | $this->singleLinkedList->push($data); 24 | $lastData = $this->singleLinkedList->pop(); 25 | $this->assertTrue($data == $lastData); 26 | } 27 | 28 | public function testAddAnotherData() 29 | { 30 | $this->testAddData(); 31 | $anotherData = $this->generateData(); 32 | $this->singleLinkedList->push($anotherData); 33 | $lastAnotherData = $this->singleLinkedList->pop(); 34 | $this->assertTrue($anotherData == $lastAnotherData); 35 | } 36 | 37 | public function testListAll() 38 | { 39 | $firstData = $this->generateData(); 40 | $secondData = $this->generateData(); 41 | $this->singleLinkedList->push($firstData); 42 | $this->singleLinkedList->push($secondData); 43 | $dataArray = [ 44 | $firstData, 45 | $secondData 46 | ]; 47 | $this->assertTrue($this->singleLinkedList->listAll() == $dataArray); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/SortableTest.php: -------------------------------------------------------------------------------- 1 | doubleLinkedList = new DoubleLinkedList(); 19 | $this->values = [ 20 | 8, 21 | 6, 22 | 5, 23 | 9, 24 | 7, 25 | 1, 26 | 12, 27 | 2, 28 | 10, 29 | 4, 30 | 11, 31 | 3, 32 | 13 33 | ]; 34 | 35 | $this->sorted = [ 36 | 1, 37 | 2, 38 | 3, 39 | 4, 40 | 5, 41 | 6, 42 | 7, 43 | 8, 44 | 9, 45 | 10, 46 | 11, 47 | 12, 48 | 13 49 | ]; 50 | foreach ($this->values as $value) { 51 | $this->doubleLinkedList->push($value); 52 | } 53 | $this->sortable = new Sortable($this->doubleLinkedList); 54 | } 55 | 56 | public function testBucketSort() 57 | { 58 | $start = microtime(); 59 | $this->assertEquals($this->sortable->bucketSort(), $this->sorted); 60 | $end = microtime(); 61 | echo "\n" . "Bucket Sort: " . ($end - $start); 62 | } 63 | 64 | public function testBubbleSort() 65 | { 66 | $start = microtime(); 67 | $this->sortable->bubbleSort(); 68 | // print_r($this->doubleLinkedList->listAll()); 69 | $this->assertEquals($this->doubleLinkedList->listAll(), $this->sorted); 70 | $end = microtime(); 71 | echo "\n" . "Bubble Sort: " . ($end - $start); 72 | } 73 | 74 | public function testSelectionSort() 75 | { 76 | $start = microtime(); 77 | $this->sortable->selectionSort(); 78 | // print_r($this->doubleLinkedList->listAll()); 79 | $this->assertEquals($this->doubleLinkedList->listAll(), $this->sorted); 80 | $end = microtime(); 81 | echo "\n" . "Selection Sort: " . ($end - $start); 82 | } 83 | 84 | public function testShellSort() 85 | { 86 | $start = microtime(); 87 | $this->sortable->shellSort(); 88 | $this->assertEquals($this->doubleLinkedList->listAll(), $this->sorted); 89 | $end = microtime(); 90 | echo "\n" . "Shell Sort: " . ($end - $start); 91 | } 92 | 93 | public function testInsertionSort() 94 | { 95 | $start = microtime(); 96 | $this->sortable->insertionSort(); 97 | // print_r($this->doubleLinkedList->listAll()); 98 | $this->assertEquals($this->doubleLinkedList->listAll(), $this->sorted); 99 | $end = microtime(); 100 | echo "\n" . "Insertion Sort: " . ($end - $start); 101 | } 102 | 103 | public function testInsertionSortArray() 104 | { 105 | $start = microtime(); 106 | $this->sortable->insertionSortArray(); 107 | // print_r($this->doubleLinkedList->listAll()); 108 | $this->assertEquals($this->doubleLinkedList->listAll(), $this->sorted); 109 | $end = microtime(); 110 | echo "\n" . "Insertion Sort with Array: " . ($end - $start); 111 | } 112 | 113 | public function testMergeSort() 114 | { 115 | $start = microtime(); 116 | $sorted = $this->sortable->mergeSort($this->doubleLinkedList); 117 | $this->assertEquals($sorted->listAll(), $this->sorted); 118 | $end = microtime(); 119 | echo "\n" . "Merge Sort: " . ($end - $start); 120 | } 121 | 122 | public function testQuickSort() 123 | { 124 | $start = microtime(); 125 | $sorted = $this->sortable->quickSort($this->doubleLinkedList); 126 | // print_r($sorted->listAll()); 127 | $this->assertEquals($sorted->listAll(), $this->sorted); 128 | $end = microtime(); 129 | echo "\n" . "Quick Sort: " . ($end - $start); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /tests/StackTest.php: -------------------------------------------------------------------------------- 1 | stack = new Stack(); 12 | } 13 | 14 | public function generateData() 15 | { 16 | $data = md5(microtime()); 17 | return $data; 18 | } 19 | 20 | public function testAddData() 21 | { 22 | $data = $this->generateData(); 23 | $this->stack->push($data); 24 | $lastData = $this->stack->pop(); 25 | $this->assertTrue($data == $lastData); 26 | } 27 | 28 | public function testAddAnotherData() 29 | { 30 | $this->testAddData(); 31 | $anotherData = $this->generateData(); 32 | $this->stack->push($anotherData); 33 | $lastAnotherData = $this->stack->pop(); 34 | $this->assertTrue($anotherData == $lastAnotherData); 35 | } 36 | } 37 | --------------------------------------------------------------------------------