Skip to content

Commit eba642d

Browse files
Implemented Segment Tree Data Structure (#166)
* 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]>
1 parent 95286b2 commit eba642d

15 files changed

+803
-1
lines changed

Diff for: DIRECTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
* [Doublylinkedlist](./DataStructures/DoublyLinkedList.php)
2828
* [Node](./DataStructures/Node.php)
2929
* [Queue](./DataStructures/Queue.php)
30+
* SegmentTree
31+
* [SegmentTree](./DataStructures/SegmentTree/SegmentTree.php)
32+
* [SegmentTreeNode](./DataStructures/SegmentTree/SegmentTreeNode.php)
3033
* [Singlylinkedlist](./DataStructures/SinglyLinkedList.php)
3134
* [Stack](./DataStructures/Stack.php)
3235
* Trie
@@ -125,6 +128,7 @@
125128
* [Disjointsettest](./tests/DataStructures/DisjointSetTest.php)
126129
* [Doublylinkedlisttest](./tests/DataStructures/DoublyLinkedListTest.php)
127130
* [Queuetest](./tests/DataStructures/QueueTest.php)
131+
* [SegmentTreeTest](./tests/DataStructures/SegmentTreeTest.php)
128132
* [Singlylinkedlisttest](./tests/DataStructures/SinglyLinkedListTest.php)
129133
* [Stacktest](./tests/DataStructures/StackTest.php)
130134
* [Trietest](./tests/DataStructures/TrieTest.php)

Diff for: DataStructures/AVLTree/AVLTree.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
5+
* https://github.com/TheAlgorithms/PHP/pull/163
6+
*
7+
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
8+
* Thank you!
9+
*/
10+
311
namespace DataStructures\AVLTree;
412

513
/**

Diff for: DataStructures/AVLTree/AVLTreeNode.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
5+
* https://github.com/TheAlgorithms/PHP/pull/163
6+
*
7+
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
8+
* Thank you!
9+
*/
10+
311
namespace DataStructures\AVLTree;
412

513
class AVLTreeNode

Diff for: DataStructures/AVLTree/TreeTraversal.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #163
5+
* https://github.com/TheAlgorithms/PHP/pull/163
6+
*
7+
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
8+
* Thank you!
9+
*/
10+
311
namespace DataStructures\AVLTree;
412

513
abstract class TreeTraversal

Diff for: DataStructures/DisjointSets/DisjointSet.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #160
5+
* https://github.com/TheAlgorithms/PHP/pull/160
6+
*
7+
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
8+
* Thank you!
9+
*/
10+
311
namespace DataStructures\DisjointSets;
412

513
class DisjointSet

Diff for: DataStructures/DisjointSets/DisjointSetNode.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Created by: Ramy-Badr-Ahmed (https://github.com/Ramy-Badr-Ahmed) in Pull Request: #160
5+
* https://github.com/TheAlgorithms/PHP/pull/160
6+
*
7+
* Please mention me (@Ramy-Badr-Ahmed) in any issue or pull request addressing bugs/corrections to this file.
8+
* Thank you!
9+
*/
10+
311
namespace DataStructures\DisjointSets;
412

513
class DisjointSetNode

0 commit comments

Comments
 (0)