Commit Graph

111 Commits

Author SHA1 Message Date
Lê Nam Khánh
5a68ba9399 chore: fix typos in some files (#7052)
Fix typos in some files
2025-11-06 12:40:34 +02:00
Lê Nam Khánh
26b47cb5b8 chore: fix typos in src/main/java/com/thealgorithms/others/BankersAlgorithm.java (#7039)
Fix typos in src/main/java/com/thealgorithms/others/BankersAlgorithm.java
2025-11-05 12:02:56 +02:00
Lê Nam Khánh
d92ab9d89c chore: fix typos in src/main/java/com/thealgorithms/others/GaussLegendre.java (#7040)
Fix typos in src/main/java/com/thealgorithms/others/GaussLegendre.java
2025-11-05 11:56:34 +02:00
Lê Nam Khánh
08ee26f2b8 chore: fix typos in src/main/java/com/thealgorithms/others/Implementing_auto_completing_features_using_trie.java (#7041)
Fix typos in src/main/java/com/thealgorithms/others/Implementing_auto_completing_features_using_trie.java
2025-11-05 11:50:43 +02:00
Lê Nam Khánh
a3717f0563 chore: fix typos in src/main/java/com/thealgorithms/others/IterativeFloodFill.java (#7042)
Fix typos in src/main/java/com/thealgorithms/others/IterativeFloodFill.java
2025-11-05 11:43:02 +02:00
Lê Nam Khánh
c42e73bd95 chore: fix typos in src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java (#7043)
Fix typos in src/main/java/com/thealgorithms/others/MemoryManagementAlgorithms.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 11:36:52 +02:00
Hardik Pawar
f66da5e5ee refactor: Enhance docs, add tests in PrintMatrixInSpiralOrder (#6636)
* refactor: Enhance docs, add tests in `PrintMatrixInSpiralOrder`

* Fix error in BloomFilter

* Fix

* Fix

* Fix
2025-10-22 19:42:11 +00:00
Hardik Pawar
4858ec9af0 refactor: Enhance docs, code, add tests in `MaximumSumOfDistinctSubar… (#6649)
* refactor: Enhance docs, code, add tests in `MaximumSumOfDistinctSubarraysWithLengthK`

* Fix

* Fix spotbug

* Fix

* Fix

* Fix

* Fix
2025-10-17 07:53:39 +00:00
Hardik Pawar
74ddea6747 refactor: Enhance docs, code, add tests in KrishnaMurthyNumber (#6742)
* refactor: Enhance docs, code, add tests in `KrishnaMurthyNumber`

* Lint
2025-10-12 20:04:32 +00:00
Hardik Pawar
14a23b709a refactor: Enhance docs, code, add tests in LowestBasePalindrome (#6648) 2025-10-12 11:05:30 +02:00
Hardik Pawar
c0ca70498b refactor: Enhance docs, code, add tests in PageRank (#6642) 2025-10-12 06:13:58 +00:00
Hardik Pawar
7fb4c8d60f refactor: Enhance docs, code, add tests in MinimaxAlgorithm (#6641)
* refactor: Enhance docs, code, add tests in `MinimaxAlgorithm`

* Fix

* Fix

* refactor: Enhance docs, code, add tests in `HappyNumbersSeq`

* Revert "refactor: Enhance docs, code, add tests in `HappyNumbersSeq`"

This reverts commit 9e8afb4f2c.
2025-10-12 06:07:17 +00:00
Hardik Pawar
b5246c3d86 refactor: Enhance docs, code, add tests in Huffman (#6646)
* refactor: Enhance docs, code, add tests in `Huffman`

* Fix lint

* Fix lint
2025-10-12 05:50:58 +00:00
Hardik Pawar
2a004a0141 refactor: Enhance docs, code, add tests in InsertDeleteInArray (#6647) 2025-10-12 05:37:53 +00:00
Hardik Pawar
f0fb971f35 refactor: Enhance docs, add tests in PerlinNoise (#6635)
* refactor: Enhance docs, add tests in `PerlinNoise`

* Fix lint

* Fix lint

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-10-11 13:15:18 +00:00
Ruturaj Jadhav
3c071c4e08 Added HappyNumber algorithm in maths section (#6571)
* Added HappyNumber algorithm in maths section

* Fix Checkstyle: remove trailing spaces in HappyNumber

* Fix formatting: remove trailing spaces and apply clang-format

* Update HappyNumberTest.java

* Removed old HappyNumbersSeq.java as replaced by new HappyNumber.java
2025-10-09 17:31:56 +00:00
CrodiYa
16557a9b81 Feature iterative flood fill (#6584)
* feat: FloodFill Algorithm with iterative approach

- nested class Point: helper class, represents point in 2D field (x,y)
- shouldSkipPixel method: helper method to validate point
- floodFill method: iterative version of floodFill, uses Queue to add and poll Points and change it color if allowed

* feat: tests for IterativeFloodFill

-same tests as for normal floodFill and test for a big image

* docs: add link to floodFill algorithm

* codeStyle fix

* tests: add tests for edge cases

* codeStyle fix

* codeStyle fix

* codeStyle fix

* refactor: reorganize structure and add JavaDoc

- Move private methods after public methods for better readability
- Add class-level JavaDoc documentation with algorithm description and links to references
2025-10-09 17:20:19 +00:00
Sriram kulkarni
959ced9076 Added mos algorithm and dice thrower (#6591)
* Add Sum of Squares algorithm implementation

* Format code and add Wikipedia URL for Lagrange's theorem

* Fixed clang-format issues

* Added Mo's Algorithm and DiceThrower recursive algorithms

- Mo's Algorithm: Square root decomposition for offline range queries(Imp in CP)
- DiceThrower: Recursive backtracking for dice combinations(very imp)
- Both algorithms include comprehensive test suites
- Formatted with clang-format and i follow contribution guidelines

* Fixed checkstyle violation

* Fixed SpotBugs issue

* Added in PMD exclusions

* Improved test coverage for better Codecov scores.

* Fixed clang-format issues in test files

* Add Mo's Algorithm and DiceThrower algorithms with comprehensive tests
* Fixed PartitionProblem.java documentation comment placement
2025-10-08 11:51:44 +00:00
Sourav Saha
15695c6e54 Fix MiniMaxAlgorithm setScores bug and add comprehensive tests (#6566)
* Fix MiniMaxAlgorithm setScores bug and add comprehensive tests

- Fix bug in setScores method where scores.length % 1 == 0 always returned true
- Add isPowerOfTwo helper method to properly validate array length
- Add comprehensive unit tests covering edge cases and algorithm correctness
- Tests include validation for power of 2 check, minimax logic, and error handling

Fixes issue with incorrect validation logic in MiniMaxAlgorithm.setScores()

* Fix Checkstyle violations and improve setScores validation

- Replace star imports with explicit imports in test file
- Remove trailing whitespaces from all lines
- Add proper file ending newline
- Improve setScores method to handle edge cases properly
- Use direct bit manipulation for power-of-2 check as suggested
- Ensure error message is printed and scores remain unchanged for invalid input

All Checkstyle violations resolved and tests pass successfully.

* Add missing newline at end of MiniMaxAlgorithmTest.java

- Fix Checkstyle violation: NewlineAtEndOfFile
- Ensure file ends with proper newline character
- All tests continue to pass successfully

* Fix PMD violation by utilizing isPowerOfTwo method

- Replace inline bit manipulation with isPowerOfTwo method call
- Resolves PMD UnusedPrivateMethod violation
- Maintains same validation logic and error handling
- All tests continue to pass successfully

* test: improve MiniMaxAlgorithm test coverage for CodeCov

- Add comprehensive test cases for isPowerOfTwo function edge cases
- Test setScores method with various invalid array lengths (0, 3, 5, 6, 7, 9, 10, 15)
- Add tests for large valid powers of 2 (up to 64 elements)
- Ensure complete coverage of error handling branches
- Increase test count from 14 to 19 tests
- Fix partial coverage issues identified in CodeCov report

Resolves CodeCov coverage gaps in MiniMaxAlgorithm.java

* Fix checkstyle errors

* Fix checkstyle errors

---------

Co-authored-by: ssaha <ssaha@wiley.com>
Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-10-02 09:24:25 +02:00
Vicky
3961b1dab9 fix: revert ReverseStack deletion and verify linting (#6474) (#6494)
* fix: revert ReverseStack deletions and ensure lint compliance

* Fix formatting for ReverseStack and test files

* Delete ReverseStackUsingRecursion and its test as requested

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-08-22 07:41:36 +02:00
Deniz Altunkapan
6c24d27b03 Move methods from others to correct packages (#6475)
refactor: Move methods from `others` package to their respective packages
2025-08-18 22:28:19 +02:00
Oleksandr Klymenko
ef93cc1503 refactor: TwoPointers (#6374)
* refactor: TwoPointers

* refactor: fix test formatting

* refactor: fix checkstyle

* refactor: fix checkstyle
2025-07-13 09:25:26 +00:00
Piotr Idzik
7602f1ef4c chore: suppress unchecked in selected classes (#6262) 2025-06-05 19:13:46 +03:00
Hakim's Garage
e6073f8fef Add math builder (#6190) 2025-03-12 18:35:21 +02:00
varada610
4ef06822ca Create package prime, matrix and games (#6139) 2025-01-27 11:10:41 +00:00
varada610
1e6ed97fcf Refactor files to be in correctly nested packages (#6120) 2025-01-11 09:17:40 +02:00
Piotr Idzik
a9633c0000 style: include ICAST_IDIV_CAST_TO_DOUBLE (#6121) 2025-01-10 20:50:09 +02:00
Alex Klymenko
04bfaa8278 Rename Recursion package (#6081) 2024-11-03 14:13:10 +02:00
pranayh24
985c1f9dd1 Add Maximum Sliding Window algorithm (#5848) 2024-10-26 19:05:14 +00:00
Piotr Idzik
8886e0996a style: include OCP_OVERLY_CONCRETE_PARAMETER (#5833) 2024-10-14 23:46:28 +03:00
Piotr Idzik
ebc3cd2233 style: resolve some FCBL_FIELD_COULD_BE_LOCAL warnings (#5764)
style: make simple fields local
2024-10-13 15:16:10 +00:00
Hardik Pawar
596c6147af Add function documentation, enhance comments in TowerOfHanoi.java (#5533) 2024-10-13 12:30:53 +03:00
Hardik Pawar
2592a088e7 Enhance readability, add comments & function docs to SkylineProblem.java (#5534) 2024-10-07 15:26:21 +03:00
B Karthik
042d458d34 fix: change location of others to correct places (#5559) 2024-10-04 17:47:50 +00:00
Hardik Pawar
66ee59cbaf Add function documentation in Sudoku.java (#5532)
* Add function documentation and parameterized tests to Sudoku.java

* Update directory

* Update directory

* Fix clang format errors

* Change

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Remove extra line

* Change values

* Fix

* Remove test

* Update directory

* Small comment fix

* Add comment

* Generalize comment

* Fix comment

* Update directory

* Fix comment

* Add changes suggested

---------

Co-authored-by: Hardvan <Hardvan@users.noreply.github.com>
2024-10-04 18:28:03 +03:00
Alex Klymenko
bded78f888 refactor: BFPRT (#5445)
refactor: adding javadocs and tests for BFPRT
2024-09-09 10:07:30 +03:00
Alex Klymenko
b0de93b3ce refactor: change packages (#5430)
* refactor: change package

* refactor: fix name

---------

Co-authored-by: alxkm <alx@alx.com>
2024-08-30 11:58:24 +02:00
Alex Klymenko
c5b72816f3 refactor: MaximumSumOfDistinctSubarraysWithLengthK (#5433)
* refactor: MaximumSumOfDistinctSubarraysWithLengthK

* checkstyle: fix formatting

* checkstyle: fix formatting

* checkstyle: fix formatting

---------

Co-authored-by: alxkm <alx@alx.com>
2024-08-30 10:03:43 +02:00
Alex Klymenko
e2aaefebd5 refactor: CountWords (#5428)
* refactor: CountWords

* checkstyle: fix formatting

---------

Co-authored-by: alxkm <alx@alx.com>
2024-08-28 22:34:46 +02:00
Alex Klymenko
6b7a1fdbe8 refactor: QueueUsingTwoStacks (#5427)
refactor: QueueUsingTwoStacks

Co-authored-by: alxkm <alx@alx.com>
2024-08-28 22:25:46 +02:00
Alex Klymenko
0733075498 test: CountCharTest (#5423)
test: CountCharTest

Co-authored-by: alxkm <alx@alx.com>
2024-08-28 18:45:23 +02:00
Alex Klymenko
fc5a70edc9 refactor: ReturnSubsequence (#5408)
* refactor: ReturnSubsequence

* checkstyle: fix formatting

* checkstyle: fix formatting

---------

Co-authored-by: alxkm <alx@alx.com>
2024-08-27 13:12:49 +02:00
Alex Klymenko
35f23d2ddc refactor: BoyerMoore (#5395) 2024-08-26 10:33:24 +03:00
Alex Klymenko
cdb6412601 refactor: LineSweep (#5398) 2024-08-26 09:45:07 +03:00
Alex Klymenko
a5f57fbfde refactor: ArrayLeftRotationTest (#5389) 2024-08-25 23:08:10 +03:00
Alex Klymenko
25b8010ea8 refactor: cleanup EulersFunction (#5388) 2024-08-25 22:44:55 +03:00
Alex Klymenko
f3851e3adc refactor: RemoveDuplicateFromString (#5387) 2024-08-25 22:33:41 +03:00
Alex Klymenko
101cb950ae refactor: RootPrecision (#5383) 2024-08-25 11:34:12 +03:00
Alex Klymenko
69e1fe9cfb refactor: LowestBasePalindrome (#5385) 2024-08-25 10:16:14 +03:00
Alex Klymenko
0b0b26e3fe refactor: ReverseStackUsingRecursion (#5386) 2024-08-25 10:12:17 +03:00