Skip to content

Commit

Permalink
Implemented Segment Tree Data Structure (#166)
Browse files Browse the repository at this point in the history
* Added Disjoint Sets Data structure

* Moved DisjointSetTest.php to  tests/DataStructures

* Update DataStructures/DisjointSets/DisjointSet.php

Co-authored-by: Brandon Johnson <[email protected]>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <[email protected]>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <[email protected]>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <[email protected]>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <[email protected]>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <[email protected]>

* Considered PHPCS remarks. Unit Testing is now working.

* Remove data type mixed. Considered annotations for php7.4.

* Remove data type mixed. Considered annotations for php7.4.

* updating DIRECTORY.md

* Implemented Trie DataStructure

* Added Trie to DIRECTORY.md

* updating DIRECTORY.md

* Implemented AVLTree DataStructure

* updating DIRECTORY.md

* Implemented AVLTree DataStructure

* Implemented SegmentTreeNode.php

* Implementing SegmentTree

* Implementing SegmentTree with updateTree

* Implementing SegmentTree with rangeUpdateTree

* Implementing SegmentTree with query and queryTree

* Added serializing and deserializing of the SegmentTree

* Adding unit tests SegmentTree implementation

* Added unit tests for SegmentTree updates and range updates

* considering PHPCS for Added unit tests for SegmentTree updates and range updates

* Added unit tests for SegmentTree serialization/deserialization and array updates reflections

* Added unit tests for SegmentTree  Edge Cases

* Added unit tests for SegmentTree Exceptions (OutOfBoundsException, InvalidArgumentException)

* Added SegmentTree to DIRECTORY.md

* Implemented Segment Tree Data Structure

* Added some comments to my files in: #160, #162, #163, #166. Implemented Segment Tree Data Structure.

* Added some comments to my files in: #160, #162, #163, #166. Implemented Segment Tree Data Structure.

* Added comments time complexity for query(), update() and buildTree()

---------

Co-authored-by: Brandon Johnson <[email protected]>
Co-authored-by: Ramy-Badr-Ahmed <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 95286b2 commit eba642d
Show file tree
Hide file tree
Showing 15 changed files with 803 additions and 1 deletion.
4 changes: 4 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
* [Doublylinkedlist](./DataStructures/DoublyLinkedList.php)
* [Node](./DataStructures/Node.php)
* [Queue](./DataStructures/Queue.php)
* SegmentTree
* [SegmentTree](./DataStructures/SegmentTree/SegmentTree.php)
* [SegmentTreeNode](./DataStructures/SegmentTree/SegmentTreeNode.php)
* [Singlylinkedlist](./DataStructures/SinglyLinkedList.php)
* [Stack](./DataStructures/Stack.php)
* Trie
Expand Down Expand Up @@ -125,6 +128,7 @@
* [Disjointsettest](./tests/DataStructures/DisjointSetTest.php)
* [Doublylinkedlisttest](./tests/DataStructures/DoublyLinkedListTest.php)
* [Queuetest](./tests/DataStructures/QueueTest.php)
* [SegmentTreeTest](./tests/DataStructures/SegmentTreeTest.php)
* [Singlylinkedlisttest](./tests/DataStructures/SinglyLinkedListTest.php)
* [Stacktest](./tests/DataStructures/StackTest.php)
* [Trietest](./tests/DataStructures/TrieTest.php)
Expand Down
8 changes: 8 additions & 0 deletions DataStructures/AVLTree/AVLTree.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
* https://github.com/TheAlgorithms/PHP/pull/163
*
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
* Thank you!
*/

namespace DataStructures\AVLTree;

/**
Expand Down
8 changes: 8 additions & 0 deletions DataStructures/AVLTree/AVLTreeNode.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
* https://github.com/TheAlgorithms/PHP/pull/163
*
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
* Thank you!
*/

namespace DataStructures\AVLTree;

class AVLTreeNode
Expand Down
8 changes: 8 additions & 0 deletions DataStructures/AVLTree/TreeTraversal.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
* https://github.com/TheAlgorithms/PHP/pull/163
*
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
* Thank you!
*/

namespace DataStructures\AVLTree;

abstract class TreeTraversal
Expand Down
8 changes: 8 additions & 0 deletions DataStructures/DisjointSets/DisjointSet.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #160
* https://github.com/TheAlgorithms/PHP/pull/160
*
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
* Thank you!
*/

namespace DataStructures\DisjointSets;

class DisjointSet
Expand Down
8 changes: 8 additions & 0 deletions DataStructures/DisjointSets/DisjointSetNode.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php

/*
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #160
* https://github.com/TheAlgorithms/PHP/pull/160
*
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
* Thank you!
*/

namespace DataStructures\DisjointSets;

class DisjointSetNode
Expand Down
Loading

0 comments on commit eba642d

Please sign in to comment.