Commit Graph

1120 Commits

Author SHA1 Message Date
codeahl
520151ab8e Add Big-O time and space complexity comments for sorting algorithms (#7155)
Add time and space complexity comments for specific sorting algorithms

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-12-10 10:00:28 +01:00
Daniel Sánchez Núñez
316def4ea6 Add Snell's Law refraction algorithm (#7150)
* Add Snell's Law implementation for refraction angle

* Add tests for Snell's Law calculations

* Update documentation with reference link to Snell's Law

Added a reference link to Snell's Law in the documentation.

* Prevent instantiation of SnellLaw class

Make SnellLaw class non-instantiable by adding a private constructor.

* Rename SnellsLawTest to SnellLawTest

* Refactor SnellLawTest for clarity and accuracy

* Rename SnellsLaw.java to SnellLaw.java

* Refactor SnellLawTest with additional assertions

* Refactor SnellLaw class constructor and error handling

Refactor SnellLaw constructor and error message formatting.

* Fix missing newline at end of SnellLawTest.java

Ensure that the SnellLawTest class has a newline at the end of the file.

* Simplify assertions in SnellLawTest

* Simplify exception throwing for total internal reflection
2025-12-07 12:18:55 +01:00
espinosadev
246162e5bd Fixed redundant boolean logic (#7151) 2025-12-05 16:45:25 +01:00
duvvuvenkataramana
8d2cdb27db feat: implement One-Time Pad cipher (#6941) (#7096)
* feat: implement One-Time Pad cipher (#6941)

* style: format OneTimePadCipher with clang-format
2025-12-01 20:17:32 +00:00
Shewale Gopal Sanjay
14c0b0844e Added threaded binary tree (#6995)
* Add One-Time Pad Cipher implementation in Java

* Add One-Time Pad Cipher implementation (fixed)

* Add ThreadedBinaryTree with in-order traversal and tests

* feat: add threaded binary tree implementation and tests

* fix: remove redundant null check for SpotBugs compliance
2025-12-01 20:13:14 +00:00
Taranjeet Singh Kalsi
ac6fef19dc Added program to check either number is Evil or Odious (#6958)
added program for evil number
2025-11-30 22:37:41 +00:00
Taranjeet Singh Kalsi
a9ba87c4b6 Added program to check Abundant number (#6961)
added program for abundant number
2025-11-28 08:51:28 +00:00
Sameer Prajapati
4c5525a2e0 feat: Added Gomory–Hu Tree (all-pairs min-cuts via n1 max-flows) (#6818)
* Add Gomory–Hu Tree (all-pairs min-cuts via n1 max-flows)

* Stabilize Monte Carlo integration with antithetic variates to reduce variance

* Fix Checkstyle in GomoryHuTreeTest: remove inner assignments, add braces, split declarations

* SpotBugs: use RandomGenerator interface in test helper

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-11-28 08:47:53 +00:00
Gokul45-45
d1ea306920 feat: add Valid Parentheses algorithm using Stack (#7117)
* feat: add Valid Parentheses algorithm using Stack

* fix: add missing ValidParentheses.java implementation

* fix: remove trailing spaces and add newline at EOF

* fix: remove misplaced ValidParentheses.java from root
2025-11-27 11:29:48 +00:00
Jayana Anjani Pavan Vardhan Naidu
e841d73837 Update Javadoc for perimeterIrregularPolygon method (#7141)
Fixed incorrect @return description in perimeterIrregularPolygon method javadoc. Changed "trapezoid" to "irregular polygon" to accurately reflect what the method calculates.
2025-11-27 12:25:52 +01:00
prasanth-30011
a14e1e3766 docs: improve javadoc for Combination class (#7126)
Updated class documentation to reflect that the class finds combinations instead of permutations.
2025-11-26 12:21:07 +01:00
Eswar Venkata Ram Charan Seeram
1c6026ecc6 fix: correct error message in surfaceAreaCylinder method (#7106) 2025-11-24 21:16:16 +01:00
KANAKALA SAI KIRAN
fa8ea8e614 Feature/centroid decomposition (#7086)
* feat: Add Centroid Decomposition for trees (#7054)

- Implement CentroidDecomposition with O(N log N) construction
- Add CentroidTree class with parent tracking and query methods
- Include buildFromEdges helper for easy tree construction
- Add comprehensive test suite with 20+ test cases
- Cover edge cases, validation, and various tree structures

Closes #7054

* feat: Add Centroid Decomposition for trees (#7054)

- Implement CentroidDecomposition with O(N log N) construction
- Add CentroidTree class with parent tracking and query methods
- Include buildFromEdges helper for easy tree construction
- Add comprehensive test suite with 20+ test cases
- Cover edge cases, validation, and various tree structures

Closes #7054

* fix: Remove trailing whitespace from CentroidDecompositionTest

* fix: Remove trailing whitespace and add newlines at end of files

* fix: Format code to comply with clang-format and checkstyle requirements

* style: Fix lambda formatting in test assertions

- Change single-line lambdas to multi-line format
- Align with repository code style guidelines

* style: Apply clang-format to match repository style guide

- Format code according to .clang-format configuration
- Use single-line lambdas as allowed by AllowShortLambdasOnASingleLine: All
- Apply 4-space indentation
- Ensure proper line endings
2025-11-22 09:44:34 +00:00
shreeya-g10
3519e396af backtracking: add unique permutation algorithm with test cases (#7078)
* Add unique permutation algorithm and test cases

* Fix: add braces for checkstyle

* Apply clang-format
2025-11-19 18:20:46 +02:00
GOPISETTI NAVADEEP
9f2b675f3e feat: add Sudoku Solver using Backtracking (#7073)
* feat: add Sudoku Solver using Backtracking (issue #6929)

* refactor: remove old Sudoku class from puzzlesandgames package

* Remove old Sudoku implementation and its test class
2025-11-17 09:54:20 +01:00
SeungHyeok Yun
cff5d3662e feat: add IndexedPriorityQueue implementation and tests (#7062)
* feat: add IndexedPriorityQueue implementation and tests

* mod : clang-format

* Fix Checkstyle naming for IndexedPriorityQueue tests

* Align IndexedPriorityQueue tests with Checkstyle and clang-format
2025-11-16 19:49:30 +01:00
GOPISETTI NAVADEEP
c6880c195d feat: add Sieve of Eratosthenes algorithm (#7071)
* feat: add Sieve of Eratosthenes algorithm

- Implement Sieve of Eratosthenes for finding prime numbers up to n
- Add comprehensive unit tests with edge cases
- Include JavaDoc documentation
- Time complexity: O(n log log n)
- Space complexity: O(n)

Resolves #6939

* fix: remove trailing spaces

* fix: apply clang-format
2025-11-16 12:00:21 +00:00
GOPISETTI NAVADEEP
93811614b8 feat: add Count Set Bits algorithm (#7072)
* feat: add Count Set Bits algorithm (issue #6931)

* fix: correct CountSetBits algorithm logic

* style: apply clang-format to CountSetBits files

* fix: correct test expectations for CountSetBits

* fix: correct test expectations for CountSetBits
2025-11-16 12:54:43 +01:00
Krishna
3979e824b7 Add Power of Four Check using bit manipulation (#7065)
* Add Power of Four Check using bit manipulation

- Implements isPowerOfFour method using bit manipulation
- Checks if number is power of two and has bit at even position
- Includes comprehensive unit tests
- Fixes #6940

* Fix code formatting in PowerOfFourTest

* Move PowerOfFour classes to maths package

* Fix package declaration in PowerOfFourTest

* Fix code formatting in PowerOfFourTest

* Remove redundant import from PowerOfFourTest

* Remove unrelated file
2025-11-15 18:36:01 +01:00
Taranjeet Singh Kalsi
98eecb9f16 Added program to check Smith number (#6955)
added smith number program
2025-11-15 09:32:06 +00:00
Krishna
8a339ef2e2 Add Temperature Conversion Utility (#7066)
- Implements conversions between Celsius, Fahrenheit, and Kelvin
- Includes all 6 conversion methods
- Adds comprehensive unit tests with edge cases
- Fixes #6936
2025-11-15 10:22:36 +01:00
PRINCE PATEL
2588af0205 fix: Correct typo in ExponentialSearch filename (#7056) 2025-11-07 11:32:18 +01:00
Priyanshu Kumar Singh
4951fb9ce2 [FEAT] Add Kinematics (SUVAT) equations (#7053)
[FEAT] Add SUVAT equation for motion

Co-authored-by: Priyanshu1303d <priyanshu130d@gmail.com>
2025-11-06 18:41:39 +01:00
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
Arzoo1701
d126fd59f7 Add Trapping Rainwater problem implementation (Two Pointer Approach) (#6990)
* Add Trapping Rainwater problem implementation (Two Pointer Approach)

* Add Wikipedia reference link for Trapping Rainwater problem

* fix: format TrappingRainwater.java for CI check

* fix: add package and resolve checkstyle errors for TrappingRainwater.java

* fix: declare TrappingRainwater as final to pass Checkstyle

* Add test cases for TrappingRainwater algorithm

* Add test cases for TrappingRainwater algorithm

* Move TrappingRainwater algorithm to stacks package

* Fix: Move TrappingRainwater to stacks and normalize newline in JugglerSequence

* Fix: Normalize newline in JugglerSequence to ensure test consistency

* Fix: Normalize newline in JugglerSequence and remove return statement

* Add JaCoCo plugin for code coverage reporting

* Revert pom.xml to original version from master

* Fix: Revert the pom.xml file

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-11-05 18:41:08 +01:00
Lê Nam Khánh
d28fee9665 chore: fix typos in src/main/java/com/thealgorithms/dynamicprogramming/BoundaryFill.java (#7049)
Fix typos in src/main/java/com/thealgorithms/dynamicprogramming/BoundaryFill.java
2025-11-05 15:53:18 +00:00
Lê Nam Khánh
c7cb54ed84 chore: fix typos in src/main/java/com/thealgorithms/datastructures/trees/CeilInBinarySearchTree.java (#7048)
Fix typos in src/main/java/com/thealgorithms/datastructures/trees/CeilInBinarySearchTree.java
2025-11-05 15:49:00 +00:00
Lê Nam Khánh
147da38888 chore: fix typos in src/main/java/com/thealgorithms/ciphers/AES.java (#7047)
Fix typos in src/main/java/com/thealgorithms/ciphers/AES.java

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-11-05 15:45:27 +00:00
Lê Nam Khánh
702664116d chore: fix typos in src/main/java/com/thealgorithms/backtracking/FloodFill.java (#7046)
Fix typos in src/main/java/com/thealgorithms/backtracking/FloodFill.java
2025-11-05 16:41:33 +01:00
Avaneeshakrishna
53230842f2 add CombinationSum and test (#6725)
* add CombinationSum and test

* Format array and list literals in CombinationSumTest

* Fix sorting comparator in CombinationSumTest

* Refactor CombinationSum for better handling and clarity

Updated combinationSum method to handle null or empty candidates and improved variable naming for clarity.

* Fix sorting comparator in CombinationSumTest

* Update CombinationSumTest.java

* Fix sorting comparator for list of integers

* Fix formatting issues in CombinationSum class

* Change CombinationSum class to final

* Refactor norm method to accept Iterable instead of List

* Remove unnecessary whitespace in CombinationSumTest
2025-11-05 11:22:39 +00:00
Lê Nam Khánh
8c8527c2c8 chore: fix typos in src/main/java/com/thealgorithms/datastructures/trees/AVLSimple.java (#7029)
Fix typos in src/main/java/com/thealgorithms/datastructures/trees/AVLSimple.java
2025-11-05 11:12:14 +00:00
Lê Nam Khánh
0c277a1d9e chore: fix typos in src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java (#7027)
Fix typos in src/main/java/com/thealgorithms/datastructures/heaps/FibonacciHeap.java
2025-11-05 11:08:49 +00:00
Lê Nam Khánh
d75a668870 chore: fix typos in src/main/java/com/thealgorithms/datastructures/trees/BSTRecursiveGeneric.java (#7030)
Fix typos in src/main/java/com/thealgorithms/datastructures/trees/BSTRecursiveGeneric.java
2025-11-05 11:05:13 +00:00
Lê Nam Khánh
65eeb5579e chore: fix typos in src/main/java/com/thealgorithms/devutils/nodes/SimpleNode.java (#7031)
Fix typos in src/main/java/com/thealgorithms/devutils/nodes/SimpleNode.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 11:01:44 +00:00
Lê Nam Khánh
96304bda30 chore: fix typos in src/main/java/com/thealgorithms/devutils/nodes/SimpleTreeNode.java (#7032)
Fix typos in src/main/java/com/thealgorithms/devutils/nodes/SimpleTreeNode.java
2025-11-05 10:56:44 +00:00
Lê Nam Khánh
8ae57476b1 chore: fix typos in src/main/java/com/thealgorithms/devutils/nodes/TreeNode.java (#7033)
Fix typos in src/main/java/com/thealgorithms/devutils/nodes/TreeNode.java
2025-11-05 10:53:11 +00:00
Lê Nam Khánh
fab09e7da1 chore: fix typos in src/main/java/com/thealgorithms/datastructures/graphs/MatrixGraphs.java (#7026)
Fix typos in src/main/java/com/thealgorithms/datastructures/graphs/MatrixGraphs.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:48:33 +00:00
Lê Nam Khánh
dd01b35d97 chore: fix typos in src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java (#7025)
Fix typos in src/main/java/com/thealgorithms/datastructures/graphs/BellmanFord.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:44:45 +00:00
Lê Nam Khánh
19f0f0bd83 chore: fix typos in src/main/java/com/thealgorithms/conversions/TurkishToLatinConversion.java (#7024)
Fix typos in src/main/java/com/thealgorithms/conversions/TurkishToLatinConversion.java
2025-11-05 10:40:08 +00:00
Lê Nam Khánh
b87b1102d0 chore: fix typos in src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java (#7028)
Fix typos in src/main/java/com/thealgorithms/datastructures/queues/PriorityQueues.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:35:18 +00:00
Lê Nam Khánh
88c8e3935c chore: fix typos in src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java (#7034)
Fix typos in src/main/java/com/thealgorithms/divideandconquer/ClosestPair.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:31:34 +00:00
Lê Nam Khánh
500c526451 chore: fix typos in src/main/java/com/thealgorithms/divideandconquer/SkylineAlgorithm.java (#7035)
Fix typos in src/main/java/com/thealgorithms/divideandconquer/SkylineAlgorithm.java
2025-11-05 10:27:10 +00:00
Lê Nam Khánh
f403ce66f9 chore: fix typos in src/main/java/com/thealgorithms/maths/BinomialCoefficient.java (#7036)
Fix typos in src/main/java/com/thealgorithms/maths/BinomialCoefficient.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:23:30 +00:00
Lê Nam Khánh
1645f31e79 chore: fix typos in src/main/java/com/thealgorithms/maths/SieveOfAtkin.java (#7037)
Fix typos in src/main/java/com/thealgorithms/maths/SieveOfAtkin.java

Co-authored-by: a <19151554+alxkm@users.noreply.github.com>
2025-11-05 10:16:55 +00:00
Lê Nam Khánh
3b14d6d398 chore: fix typos in src/main/java/com/thealgorithms/matrix/RotateMatrixBy90Degrees.java (#7038)
Fix typos in src/main/java/com/thealgorithms/matrix/RotateMatrixBy90Degrees.java
2025-11-05 12:13:26 +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