Commit Graph

986 Commits

Author SHA1 Message Date
Hetu Kariya
fb12971fd6 Added BitwiseGCD.java and BitwiseGCDTest.java (#6545) 2025-09-27 13:02:34 +02:00
Rahul P
5fee204773 Added PriorityQueueSort algorithm and Tests (#6532)
* Added PriorityQueueSort.java

Implemented PriorityQueueSort using Java's PriorityQueue (Min-Heap).
- Returns the array sorted in ascending order
- Time complexity: O(n log n)
- Space complexity: O(n)

* Added tests for PriorityQueueSort

* Update PriorityQueueSortTest.java

* Fixed formatting and added full coverage tests for PriorityQueueSort

* Update PriorityQueueSort.java

* Update PriorityQueueSort.java

* Update PriorityQueueSort.java

* Update PriorityQueueSortTest.java

* Update PriorityQueueSort.java

* Update PriorityQueueSort.java

* Update PriorityQueueSort.java

* Fix formatting with clang-format
2025-09-18 20:02:15 +02:00
Nithin U
85a2df46ad To add Suffix array algorithm implementation (#6530)
* adding Suffix Array Implementation

* adding test for Suffix Array

* patch: lint fix in SuffixArray.java

* patch: lint fix in SuffixArrayTest.java

* fix: private constructor update

* patch: lint fix in suffix array impl

* fix: lint issue line blankspace removal

* fix: checkstype issue

* fix: lint format issue

* Update DIRECTORY.md
2025-09-17 17:56:10 +02:00
Priyansh
1393f5ea6b Added-> DisjointUnion Set by Size (#6514)
* Added-> DisjointUnion Set by Size

* Add tests for DisjointSetUnionBySize

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-09-03 19:05:12 +02:00
Nihar Kakani
27ada8a649 Migrate recursive reverse string method and tests to ReverseString (#6504)
* Migrate recursive reverse string method and tests to ReverseString

- Moved recursive reverse method from ReverseStringRecursive.java to ReverseString.java
- Moved tests from ReverseStringRecursiveTest.java to ReverseStringTest.java
- Deleted old ReverseStringRecursive files

* Fix formatting for ReverseStringTest.java as per clang-format linter
2025-08-27 16:59:04 +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
Stathis Veinoglou
2dd6a13707 Add DFS with parent-completion constraint for DAG traversal (#6467)
* Add DFS with parent-completion constraint for DAG traversal

* warning in PartitionProblem.java affecting tests

* added clang-format and updated javadoc

* optimized imports and rechecked camelCase format in tests

* removed .* import and made small visual change

* replaced a inline return with correct {} block

* Removed changed in PartitionProblem.java, Renamed class name to be straightforward about the implementation.Added full names instead of shortcuts, and included record.

* updated for clang format

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-08-15 16:41:52 +00:00
ptzecher
657f433413 Hopcroft karp Algorithm implementation and tests (#6465)
* Add Hopcroft-Karp algorithm and tests

* Adding wikipedia url for Algorithm

* fixing test issues

* remove unused field flagged by PMD
2025-08-14 19:42:51 +02:00
Navaneedan S
e09c98578f Add ReverseStringUsingStack (#6452)
* Refactored ReverseStringUsingStack
* Add ReverseStringUsingStack
* Refactored ReverseStringUsingStack
* Closes #6451
2025-08-01 21:16:10 +02:00
dinishajais
a8b579e293 #6336/enhancement/Refactor: Standardize comparison logic using SortUtils (#6442)
* Refactoring compareTo() to SortUtils methods

* Adding formatting

* Removed excess parenthesis

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-26 08:37:54 +00:00
Lucas Gomes
2eb80fb843 Remove duplicate SimpleSort (same logic as ExchangeSort) (#6441)
* Remove duplicate SimpleSort (same logic as ExchangeSort)

* Removed test class for SimpleSort as it was also duplicate

---------

Co-authored-by: Lucas G <lucasgomesm1808@gmail.com>
2025-07-26 10:34:00 +02:00
Vishwajeet Deshmane
cfd784105b Feat(Improved): Add 0/1 Knapsack Problem: Recursive and Tabulation (Bottom-Up DP) Implementations in Java along with their corresponding Tests (#6425)
* feat: Add 0/1 Knapsack and its tabulation implementation with their corresponding tests

* feat: Add 0/1 Knapsack and its tabulation implementation with their corresponding tests

* feat: Add 0/1 Knapsack and its tabulation implementation with their corresponding tests

* Feat:add 0/1knapsack and 0/1knapsacktabulation along with their tests

* Feat:add 0/1knapsack and 0/1knapsacktabulation along with their tests

* Feat:add 0/1knapsack and 0/1knapsacktabulation along with their tests

---------

Co-authored-by: Oleksandr Klymenko <alexanderklmn@gmail.com>
2025-07-22 19:17:24 +02:00
IDDQD
c9cc8f4698 Add cache with LIFO replacement policy (#6390)
* Added Random Replacement cache

* Implement cache with LIFO replacement policy

* Ran clang-format

* Make necessary variables final, replace HashMap.newHashMap(int capacity) with new HashMap<>(int capacity)

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-21 18:11:13 +02:00
Nishitha Wihala
2dfad7ef8f Add matrix multiplication with double[][] and unit tests (#6417)
* MatrixMultiplication.java created and updated.

* Add necessary comment to MatrixMultiplication.java

* Create MatrixMultiplicationTest.java

* method for 2 by 2 matrix multiplication is created

* Use assertMatrixEquals(), otherwise there can be error due to floating point arithmetic errors

* assertMatrixEquals method created and updated

* method created for 3by2 matrix multiply with 2by1 matrix

* method created for null matrix multiplication

* method for test matrix dimension error

* method for test empty matrix input

* testMultiply3by2and2by1 test case updated

* Check for empty matrices part updated

* Updated Unit test coverage

* files updated

* clean the code

* clean the code

* Updated files with google-java-format

* Updated files

* Updated files

* Updated files

* Updated files

* Add reference links and complexities

* Add test cases for 1by1 matrix and non-rectangular matrix

* Add reference links and complexities

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-21 16:07:13 +00:00
Oleksandr Klymenko
31bf130e9e refactor: improving Median (#6404)
refactor: improving Median

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-20 08:21:46 +00:00
Oleksandr Klymenko
434ab50ff4 refactor: Convolution (#6382)
refactor: Convolution

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-16 15:05:13 +00:00
Oleksandr Klymenko
d55e89dc71 refactor: Mode (#6381)
refactor: Mode
2025-07-16 17:02:16 +02:00
Oleksandr Klymenko
dcb02c61df refactor: MajorityElement (#6380)
* refactor: MajorityElement

* refactor: fix import ordering

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-15 17:10:06 +02:00
Oleksandr Klymenko
287a708c7f refactor: Intersection (#6379)
refactor: Intersection improvement
2025-07-15 17:04:58 +02:00
Oleksandr Klymenko
ca7c77f16b refactor: improving DisjointSetUnion (#6378)
* refactor: improving DisjointSetUnion

* refactor: remove comment as it already in description

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-15 05:31:09 +00:00
Oleksandr Klymenko
7e37d94c53 refactor: improving readability DecimalToAnyUsingStack (#6377)
refactor: improving readability DecimalToAnyUsingStack

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-15 05:26:49 +00:00
Oleksandr Klymenko
95116dbee4 refactor: improving MedianOfMatrix (#6376)
refactor: improving MedianOfMatrix
2025-07-15 07:23:49 +02:00
Oleksandr Klymenko
25aaa6e064 refactor: OnesComplement Tests Using Parameterized Inputs (#6375)
refactor: OnesComplement Tests Using Parameterized Inputs

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-14 05:51:17 +00:00
Oleksandr Klymenko
933e929b54 refactor: refactor Ceil and improved tests (#6366)
* refactor: refactor Ceil and improved tests

* checkstyle: remove redundant import

* refactor: fix edge cases

* refactor: fix checkstyle

* refactor: fix checkstyle import order
2025-07-14 07:47:22 +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
Oleksandr Klymenko
182118b6a4 refactor: cleanup GenerateSubsets (#6373)
refactor: cleanup GenerateSubsets

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-13 09:17:38 +00:00
Oleksandr Klymenko
910d5b880a refactor: Refactor SJFScheduling and Tests (#6372)
* refactor: Refactor SJFScheduling and Tests

* refactor: fix checkstyle

* refactor: add full imports

* refactor: add full imports

* refactor: remove redundant newline

* refactor: fix indexed list iteration
2025-07-13 11:11:57 +02:00
Oleksandr Klymenko
dba2d869f2 refactor: improving GenericRoot (#6365)
refactor: improving GenericRoot
2025-07-12 06:51:49 +00:00
Oleksandr Klymenko
7590d8234f refactor: add JavaDocs and improve readability in InfixToPrefix (#6363)
* refactor: add JavaDocs and improve readability in InfixToPrefix

* formatting: remove redundant newline

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-12 06:47:49 +00:00
Oleksandr Klymenko
acb4753d65 refactor: Improve readability and code clarity in InfixToPostfix (#6362)
refactor: improve InfixToPostfix

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-12 08:44:57 +02:00
Oleksandr Klymenko
0a4f5542d9 cleanup: Improve docs, safety, and readability in RangeInSortedArray (#6361)
* cleanup: Improve docs, safety, and readability in RangeInSortedArray

* formatting: fix comment formatting issue

* formatting: fix array formatting issue

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-11 19:42:45 +00:00
Oleksandr Klymenko
048bba9499 refactor: adding docs for LongestCommonPrefixTest and Parameterized Tests (#6360)
* refactor: adding docs for LongestCommonPrefixTest and Parameterized Tests

* checkstyle: fix clang formatting

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-11 19:39:33 +00:00
Oleksandr Klymenko
3e0fd11a96 refactor: refactoring and documenting Isomorphic String Checker (#6359)
refactor: refactoring and documenting Isomorphic String Checker

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-11 19:36:29 +00:00
Oleksandr Klymenko
2ccc15671f refactor: clean up LargestRectangle and convert tests to parameterized format (#6356)
* refactor: clean up LargestRectangle and convert tests to parameterized format

* refactor: fix clang formatting issue

* refactor: fix clang formatting issue for test data

---------

Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-11 21:32:42 +02:00
Oleksandr Klymenko
f3252793e1 refactor: refactor Alphabetical and AlphabeticalTest (#6355) 2025-07-10 17:52:38 +02:00
Oleksandr Klymenko
a6aadd5b64 refactor: improve Sparsity class with input validation and clearer logic (#6351)
Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
2025-07-09 18:49:58 +00:00
Oleksandr Klymenko
c997a32018 refactor ShuffleArray: improve documentation and maintainability (#6357)
refactor ShuffleArray: Improve Documentation and Code Quality
2025-07-09 20:36:39 +02:00
Oleksandr Klymenko
6c3049530f refactor: optimize ValidParentheses methods and add parameterized tests (#6352) 2025-07-08 10:50:06 +03:00
Oleksandr Klymenko
fa2ca9db39 refactor: improve PythagoreanTriple logic and add parameterized tests (#6350) 2025-07-08 00:29:52 +03:00
Oleksandr Klymenko
2f5bc8c242 refactor: improve median calculator class design and readability (#6349) 2025-07-07 14:29:10 +03:00
Oleksandr Klymenko
4b6006c876 refactor: improve code and test coverage for MapReduce example (#6348)
refactor: improve code and test coverage for MapReduce example
2025-07-06 23:19:50 +02:00
Oleksandr Klymenko
350f149657 Add parameterized tests for BitSwap (#6347) 2025-07-06 20:03:02 +03:00
KevinMwita7
c782f05ed4 Add cache with FIFO replacement policy (#6337) 2025-07-05 13:29:46 +00:00
Aditya
d709317b2e Add RandomizedClosestPair Algorithm and Unit Tests (#6339) 2025-07-04 10:23:49 +00:00
Aditya
58ac54cbdb Add Freivalds' Algorithm for randomized matrix multiplication verification (#6340) 2025-07-04 13:16:57 +03:00
codingmydna
712ada5102 Correct column pointer initialization in RowColumnWiseSorted2dArrayBinarySearch (#6333) 2025-07-02 12:51:56 +00:00
KevinMwita7
bb36d13c93 Add RR cache (#6307) 2025-06-30 18:45:37 +00:00
02RdDT
616d15a408 Shortest coprime segment using sliding window technique (#6296)
* Shortest coprime segment using sliding window technique

* mvn checkstyle passes

* gcd function reformatted

* fixed typo in ShortestCoprimeSegment

* 1. shortestCoprimeSegment now returns not the length, but the shortest segment itself.
2. Testcases have been adapted, a few new ones added.

* clang formatted ShortestCoprimeSegmentTest.java code
2025-06-18 21:29:35 +02:00
Deniz Altunkapan
1745d19f09 refactor: unified duplicate Anagram classes into a single implementation (#6290) 2025-06-11 20:04:06 +03:00