128 Commits

Author SHA1 Message Date
Ramy
eba642dbbe
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 <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* 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 <bbj1979@gmail.com>
Co-authored-by: Ramy-Badr-Ahmed <Ramy-Badr-Ahmed@users.noreply.github.com>
2024-09-30 23:28:03 -06:00
Ramy
e43b4bfec8
Implemented AVL Tree Data Structure (#163)
* Added Disjoint Sets Data structure

* Moved DisjointSetTest.php to  tests/DataStructures

* Update DataStructures/DisjointSets/DisjointSet.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* 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 AVLTree DataStructure

* Implemented AVLTree DataStructure

---------

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>
Co-authored-by: Ramy-Badr-Ahmed <Ramy-Badr-Ahmed@users.noreply.github.com>
2024-09-17 23:07:12 -06:00
Ramy
42badbfdac
Implemented Trie Data Structure (#162)
* Added Disjoint Sets Data structure

* Moved DisjointSetTest.php to  tests/DataStructures

* Update DataStructures/DisjointSets/DisjointSet.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* 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

---------

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>
Co-authored-by: Ramy-Badr-Ahmed <Ramy-Badr-Ahmed@users.noreply.github.com>
2024-09-17 23:00:52 -06:00
Ramy
193d032f20
Implemented Disjoint Set (Union-Find) Data Structure (#160)
* Added Disjoint Sets Data structure

* Moved DisjointSetTest.php to  tests/DataStructures

* Update DataStructures/DisjointSets/DisjointSet.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update DataStructures/DisjointSets/DisjointSetNode.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/DataStructures/DisjointSetTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* 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

---------

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>
Co-authored-by: Ramy-Badr-Ahmed <Ramy-Badr-Ahmed@users.noreply.github.com>
2024-09-13 08:06:44 -06:00
Brandon Johnson
9a80c3afd3
Merge pull request #161 from TheAlgorithms/fix-deprecated-test-class
test: fix railfence cipher test improper class and func naming
2024-09-10 23:23:03 -06:00
Brandon Johnson
18ca8fe9c0 test: fix railfence cipher test improper class and func naming 2024-09-10 23:18:00 -06:00
Brandon Johnson
920c3827ae
Merge pull request #158 from EricNeves/feature/data-structure-queue
Feature - Add Queue Data Structure Implementation
2024-08-21 14:46:13 -06:00
Brandon Johnson
6290bfaffb
psr-12 header block guidlines 2024-08-21 14:15:27 -06:00
Eric Neves
05efb2aae0 Add test to assert the value of a dequeued element 2024-08-19 10:05:30 -04:00
Michał Żarnecki
16be0f2763
Sieve of Eratosthenes algorithm (#159)
Co-authored-by: Michal Zarnecki <michal.zarnecki@companyhouse.de>
2024-08-18 22:32:25 -06:00
Eric Neves
ec6014ba0f test(queue): write tests for queue operations 2024-07-25 19:37:53 -04:00
Gabriele Dongiovanni
e6791356a1
Add shell sort (#154)
* add shell sort

* updating DIRECTORY.md

* rename shell sort test class

* updating DIRECTORY.md

---------

Co-authored-by: dongio99 <dongio99@users.noreply.github.com>
2024-07-25 11:08:05 -06:00
Abhishek Pashte
8389d29c76
Create SentinelSearch.php (#124)
* Create SentinelSearch.php

Added Sentinel Search algorithm in Searches folder

* Update SentinelSearch.php

* Update SearchesTest.php

Added tests for SentinelSearch.php

* Update DIRECTORY.md

Added link for sentinel search

* Update SearchesTest.php

Testcase corrected

* Updated SentinelSearch.php

* Updated SearchesTest.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

* Update Searches/SentinelSearch.php

---------

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>
2024-06-13 23:42:22 -06:00
Arafin Mridul
500b1bc44d
Two Pointers Algorithm added in PHP/Searches/TwoPointers.php (#152)
* Create TwoPointers.php

Two Pointers technique implementation written in PHP

* Update TwoPointers.php

* Update DIRECTORY.md

* Update TwoPointers.php

* Update TwoPointers.php

* Update SearchesTest.php

* Update TwoPointers.php

* Update TwoPointers.php
2024-06-13 23:30:53 -06:00
niharikamahajan02
afc6d11844
Added code for findng no of homogenous substrings (#146)
* Create CountHomogenous.php

Added count no of homogenous substrings

* Added program for finding no. of homogenous substrings

* Update Strings/CountHomogenous.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update Strings/CountHomogenous.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/Strings/StringsTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update StringsTest.php

* Update Strings/CountHomogenous.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update tests/Strings/StringsTest.php

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>

* Update CountHomogenous.php

* Update tests/Strings/StringsTest.php

* Update tests/Strings/StringsTest.php

* Fix homogenous count unit test

* Fix count homogenous substrings algorithm

* PHPCBF: remove inline control structure

---------

Co-authored-by: Brandon Johnson <bbj1979@gmail.com>
2024-06-13 23:26:17 -06:00
Michal Zarnecki
4661257890 Bellman-Ford code formatting 2024-05-05 13:12:27 +02:00
Michal Zarnecki
e502f58c80 Bellman-Ford shortest path algorithm PHP implementation 2024-05-05 13:08:47 +02:00
Sevada
747e8d1197
Create BaseX.php (#140)
* Create BaseX.php

This function let's you calculate base X of any number <11

* Update BaseX.php

* Update DIRECTORY.md

* Update BaseX.php

* Update BaseX.php

* Update DIRECTORY.md

Co-authored-by: Brandon Johnson <darwinz>

* Update MathsTest.php

* Update tests/Maths/MathsTest.php

Co-authored-by: Brandon Johnson <darwinz>

* Update MathsTest.php

* Update tests/Maths/MathsTest.php

Co-authored-by: Brandon Johnson <darwinz>

* Update tests/Maths/MathsTest.php

Co-authored-by: Brandon Johnson <darwinz>

---------

Co-authored-by: Brandon Johnson <darwinz>
2023-12-13 10:30:45 -07:00
Aryansh B
e0d414bb4a
Added Fast Inverse Square root (#142) 2023-10-30 12:22:15 -06:00
Shivani Yadav
9e8e95a5ac
Adding the Stack Data Structure (#137)
* Adding the Stack Data Structure

* Fixing the Lint Issue
2023-10-23 23:43:28 -06:00
Carlos Afonso
2553639335 Add Greatest Common Divisor 2023-10-22 21:35:08 +01:00
Brandon Johnson
7e052840be
Merge pull request #135 from Ravikisha/master
Adding the Doubly Linked List in Data Structure
2023-10-09 21:45:50 -06:00
Aryansh B
53d6cd64ea
Added Atbash Cipher! (#136) 2023-10-09 21:42:42 -06:00
ravikishan.69
91da583267 Fixes the lint errors 2023-10-10 08:11:21 +05:30
Aryansh B
599577bf9a
Added Railfence Cipher (#134)
* Feat: Added Railfence Cipher

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-08 18:41:13 -06:00
ravikishan.69
d4b163a564 Adding The Doubly Linked List In PHP 2023-10-08 14:41:32 +05:30
Anamarija Papić
53a432f59d adjust the given ranges in sorting tests. 2023-10-07 09:22:53 +02:00
Anamarija Papić
9910612fb9 adjust the given ranges in sorting tests. 2023-10-07 08:39:39 +02:00
Anamarija Papić
aca121fff0 rename test case class.
- to fix "Test case not matching filename" deprecation warning
2023-10-07 08:33:44 +02:00
Anamarija Papić
9b0cae985e adjust the given ranges in sorting tests.
- shortening the given ranges
- applied on the tests that hit PHP memory_limit
- applied on the tests that exceed the expected duration time
2023-10-07 08:30:28 +02:00
Anamarija Papić
8084046f1b Merge branch 'master' into fix/phpunit-sorting-tests 2023-10-07 08:05:43 +02:00
Anamarija Papić
b3774d70b0 fix count sort.
- no min and max as function parameters
- count sort tests are now passing
2023-10-06 19:57:48 +02:00
Aryansh Bhargavan
831d93b454
Fix: Changes in formatting? 2023-10-06 21:51:15 +05:30
Anamarija Papić
4c77cd2ff8 rename test case class.
- to fix "Test case class not matching filename" deprecation warning
2023-10-06 16:10:18 +02:00
Anamarija Papić
cf9764890d rename SortingTests.php to SortingTest.php.
- made this change so that PHPUnit can execute sorting tests
- sorting tests were previously ignored because of the file name typo
2023-10-06 15:26:57 +02:00
Aryansh Bhargavan
f595b7a71a
Feat: Added Vignere Cipher 2023-10-05 21:10:00 +05:30
salehhashemi1992
b814cf2669 fix some ci warnings 2023-10-05 00:01:13 +03:30
salehhashemi1992
5817388856 fix mono alphabetic cipher test structure 2023-10-04 23:45:09 +03:30
salehhashemi1992
1a04f5ea8f fix morse test structure 2023-10-04 23:44:04 +03:30
salehhashemi1992
e5523e0c4c fix conversions test structure 2023-10-04 23:40:29 +03:30
salehhashemi1992
a305f06efe fix maths test structure 2023-10-04 23:09:58 +03:30
salehhashemi1992
963bafca71 fix searches test structure 2023-10-04 23:03:29 +03:30
salehhashemi1992
39ab69ecea fix string test structure 2023-10-04 22:56:49 +03:30
salehhashemi1992
9c2726203c fix cs errors to follow the psr12 standard and also some minor fixes 2023-10-04 21:50:32 +03:30
Neto Costa
9dab8744dd fix: fix empty input validation on quicksort 2023-10-02 21:12:05 -03:00
Brandon Johnson
986d1363ff
Merge pull request #117 from salehhashemi1992/mode-function-multiple-return
Enhance mode() Function to Return Multiple Modes
2023-09-17 22:50:49 -06:00
salehhashemi1992
50f436eb17 fix mode method to return multiple modes if needed 2023-09-16 16:45:18 +03:30
salehhashemi1992
e06139805a add heap sort to sort algorithms 2023-09-16 16:31:10 +03:30
Ruben del Blanco Rey
e0cac03bc6
Project Euler Problem 11 (#113)
* feat:first approach to the problem

* feat:add Project euler problem 11
2023-05-14 22:44:05 -06:00
Ruben del Blanco Rey
f57991b8e6
Added Project Euler's problem 10 (#110)
* feat:add Project Euler problem 10

* chore:add problem in DIRECTORY
2023-04-23 22:25:55 -06:00