Commit Graph

668 Commits

Author SHA1 Message Date
Piotr Idzik
5e4db7baf1
style: include SS_SHOULD_BE_STATIC (#5198) 2024-06-02 02:54:11 +05:30
Godwill Christopher
c42b1c940c
style: enable ParameterName in CheckStyle. (#5196)
* Enabled: ParameterName in CheckStyle.

* Refactored to fix  bug caused by selfAssignment of variables in VectorCrossproduct class
2024-05-31 22:01:11 +02:00
Alex K
2568b96784
Adding class for generating all subsequences from a given List (#5194)
* Adding class for generating all subsequences from a given List

* Fix test data format

* Fix braces wrong placement

* Fix "Utility classes should not have a public or default constructor."

* Fix checkstyle " Class Subsequence should be declared as final."

* Renaming class Subsequence to SubsequenceFinder. Refactored test to Parametrized test. Fixed input parameter as final.

* Fix formatting

* Fix formatting

* Fix formatting

* Fix import ordering

* Renaming method generate all.
Renaming test method.
Adding duplication test.
Renaming TestData to TestCase.

* Fix formatting

* style: add assertion to avoid potential infinite loop

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-30 18:43:15 +00:00
S. Utkarsh
a6e873deef
style: enable MemberName in checkstyle (#5193)
* style: enable MemberName in checkstyle

* style: simply uncomment `MemberName`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-29 20:44:14 +00:00
Piotr Idzik
d2bfb100b2
style: include LII_LIST_INDEXED_ITERATING (#5190) 2024-05-28 19:06:47 +00:00
Piotr Idzik
2cda944643
style: include ENMI_EQUALS_ON_ENUM (#5189) 2024-05-28 19:03:52 +00:00
S. Utkarsh
25d711c5d8
style: enable LocalVariableName in CheckStyle (#5191)
* style: enable LocalVariableName in checkstyle

* Removed minor bug

* Resolved Method Name Bug

* Changed names according to suggestions
2024-05-28 20:29:28 +02:00
Piotr Idzik
92887a10c2
style: include NAB_NEEDLESS_BOXING_PARSE (#5184) 2024-05-28 06:47:51 +00:00
Piotr Idzik
70c1d97ab1
style: include SPP_TOSTRING_ON_STRING (#5183) 2024-05-28 02:37:20 +05:30
Godwill Christopher
295e7436b1
style: enable MethodName in CheckStyle (#5182)
enabled: MethodName in CheckStyle
2024-05-27 09:06:06 +02:00
Piotr Idzik
ea4dc15a24
style: do not suppress try (#5167) 2024-05-27 03:02:36 +05:30
Bama Charan Chhandogi
37c2a96fe2
style: enable MissingSwitchDefault in checkstyle (#5179)
* Update directory

* Update directory

* Update directory

* Update directory

* add switch default

---------

Co-authored-by: BamaCharanChhandogi <BamaCharanChhandogi@users.noreply.github.com>
2024-05-26 17:28:00 +05:30
vaibhav9t1
9eaa2bb756
style: enable MultipleVariableDeclarations in checkstyle (#5175)
Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
2024-05-25 20:18:27 +02:00
vaibhav9t1
44ce6e7b0d
style: enable StaticVariableName in checkstyle (#5173)
* style: enable StaticVariableName in checkstyle

* Refractored: enable StaticVariableName in checkstyle

* style: mark more variables as `final`

---------

Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
Co-authored-by: vil02 <vil02@o2.pl>
2024-05-25 14:09:14 +00:00
Godwill Christopher
160742104d
Enabled LocalFinalVariableName in Checkstyle (#5172) 2024-05-24 16:38:37 +05:30
Piotr Idzik
8be8b953ab
style: do not suppress this-escape (#5166) 2024-05-20 16:09:23 +00:00
Piotr Idzik
8466219685
style: do not suppress serial (#5168) 2024-05-20 20:39:31 +05:30
Piotr Idzik
bf9d0ed66a
fix: handle constant inputs in `LongestIncreasingSubsequence::findLISLen' (#5160)
fix: handle constant inputs in `LongestIncreasingSubsequence::findLISLen`
2024-05-17 15:24:22 +05:30
Godwill Christopher
0f42e995a4
style: enabled InnerAssignment in checkstyle (#5162)
* style: enabled InnerAssignment in checkstyle

* Refactor code formatting in KnapsackMemoization.java and UnionFind.java

* style: remove redundant blank line

* style: mark `includeCurrentItem` and `excludeCurrentItem` as `final`

* style: remove `KnapsackMemoization` from `pmd-exclude.properties`

* style: use `final`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-16 16:46:03 +00:00
Godwill Christopher
bbef89c885
refactor: simplify logic of Point::equals in KDTree (#5158) 2024-05-12 12:37:14 +02:00
Godwill Christopher
5703be5953
style: enable EqualsHashCode in checkstyle (#5157) 2024-05-12 11:38:07 +02:00
Piotr Idzik
319d5143cc
refactor: cleanup DudeneyNumber (#5156) 2024-05-12 14:35:33 +05:30
Piotr Idzik
cf6c87c35c
style: make SubsetCount a proper utility (#5153) 2024-05-11 14:36:17 +00:00
Godwill Christopher
bbe4a025df
style: enable FinalClass in checkstyle (#5154) 2024-05-11 08:50:05 +02:00
Piotr Idzik
52f15b2b08
style: include RV_RETURN_VALUE_IGNORED (#5152) 2024-05-09 15:23:22 +00:00
Piotr Idzik
27c0978851
style: include VA_FORMAT_STRING_USES_NEWLINE (#5151) 2024-05-09 17:21:04 +02:00
Piotr Idzik
7bff82f175
style: include LEST_LOST_EXCEPTION_STACK_TRACE (#5150) 2024-05-09 15:15:36 +00:00
Piotr Idzik
ee6924a2a0
style: include PATH_TRAVERSAL_IN (#5148) 2024-05-09 20:04:57 +05:30
Piotr Idzik
d2ddec55e5
style: include NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION (#5149)
* style: use `assertFalse` and `assertTrue`

* style: include `NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION`
2024-05-08 22:41:46 +05:30
Piotr Idzik
d3bb691f59
style: enable HideUtilityClassConstructor in checkstyle (#5147) 2024-05-08 09:58:29 +03:00
Piotr Idzik
bfb27eeb59
style: enable ArrayTypeStyle in checkstyle (#5145) 2024-05-06 22:49:52 +03:00
Piotr Idzik
414835db11
style: enable AvoidStarImport in checkstyle (#5141) 2024-05-05 20:48:56 +02:00
Piotr Idzik
dc47e0aa42
style: include ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (#5129) 2024-05-05 18:39:26 +00:00
Piotr Idzik
5d00889291
fix: handle empty inputs in CircleSort (#5121)
* fix: handle empty inputs in `CircleSort`

* style: remove `main` method
2024-05-05 23:56:54 +05:30
SOZEL
dda3c9cb59
Refactor Levenshtein distance implementation (#5138)
* ref: refactor Levenshtein distance implementation
- Rewrite the original levenshtein distance implementation in functional style
- Add optimized version of levenshtein distance

* ref: make `LevenshteinDistance` class a proper utility

* ref: remove duplicated test data

* ref: update tests

---

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-04 11:13:30 +02:00
Piotr Idzik
b3903f5768
style: enable RedundantModifier in checkstyle (#5140) 2024-05-03 22:10:49 +03:00
marysiuniq
1e2d7e9431
style: enable ConstantName in checkstyle (#5139)
Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
2024-05-02 18:31:37 +02:00
Piotr Idzik
f64bc3c65d
style: include UC_USELESS_OBJECT (#5127) 2024-05-01 11:11:03 +00:00
marysiuniq
06a284f811
style: enable ModifierOrder in checkstyle (#5132)
* style: enable `ModifierOrder` in checkstyle

* style: remove redundant `final`

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

---------

Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-01 13:06:19 +02:00
Piotr Idzik
2513ccd62b
style: include IM_AVERAGE_COMPUTATION_COULD_OVERFLOW (#5131) 2024-05-01 15:28:04 +05:30
Piotr Idzik
de18d0df7e
style: enable EmptyStatement (#5120) 2024-04-26 22:39:03 +03:00
Piotr Idzik
6de154d218
tests: add tests of Mode (#5104) 2024-04-26 06:40:01 +00:00
marysiuniq
ac598e2b93
Remove unused import. (#5113)
Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
2024-04-21 21:02:32 +02:00
marysiuniq
8129686e2e
Added tests for FactorialRecursion (#5109)
* Added tests for `FactorialRecursion`

* Apply suggestions from code review

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

---------

Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-04-20 20:31:13 +02:00
marysiuniq
7201dc78ad
Added tests for NumberOfDigits (#5107)
Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-04-13 20:45:07 +02:00
SOZEL
c53f178308
Implement Parentheses Generator (#5096)
* chore: add `ParenthesesGenerator` to `DIRECTORY.md`

* feat: implement Parentheses Generator

* ref: change `ParenthesesGenerator`s method to `static`

* ref: use parametrized tests

* ref: handling exception when `n < 0`

* chore: update docstrings

* ref: make `ParenthesesGenerator` to be a proper utility

* chore(docs): add private constructor docstring

* ref(tests): move bad name suggestions

* style: remove reduntant comments

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-04-05 18:41:27 +02:00
Kanivets Kateryna
22310defcd
Cleaned up code for some packages (#5094)
* Cleaned up code of some packages

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-04-02 21:26:06 +02:00
Piotr Idzik
098f044370
Remove CalculateMaxOfMin (#5079) 2024-03-22 19:18:08 +08:00
SOZEL
192427a5d2
Parameterize references to generic types. (#5078)
* chore: remove unused imports

* fix: parameterize references to generic types


---------

Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
2024-03-15 19:03:27 +01:00
SOZEL
ab371843ac
Close Scanner to avoid resource leak (#5077) 2024-03-12 19:49:58 +01:00
straf10
47a9b1b647
Add WelshPowell (Graph Colouring) (#5034)
* Welsh Powell Algorithm + Test


---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-02-12 20:48:07 +01:00
VedantK
14b3f45f9f
Add ExchangeSort (#5029)
* added ExchangeSort and its testcases

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-02-01 09:25:31 +01:00
Bhishmadev Ghosh
55f08cc013
Add tests SumOfSubset (#5021)
* Updated main and test

* removed

* style: reorder test cases

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-01-26 19:30:26 +01:00
Piotr Idzik
a216cb8a59
Remove unused import from HashMapCuckooHashing (#5018)
style: remove unused import from `HashMapCuckooHashing`
2024-01-13 09:28:50 +00:00
Piotr Idzik
3528399b2e
Remove unused import from JobSequencing (#5017)
style: remove unused import from `JobSequencing`
2024-01-13 10:26:44 +01:00
Piotr Idzik
ac7152d757
Remove unused imports from PerfectSquareTest (#5016)
style: remove unused imports from `PerfectSquareTest`
2024-01-13 09:21:57 +00:00
Piotr Idzik
9426053f73
Remove unused import from PowerOfTwoOrNotTest (#5015)
style: remove unused import from `PowerOfTwoOrNotTest.java`
2024-01-13 14:34:32 +05:30
Sarthak Chaudhary
8804cec957
Feature/4638 array right rotation (#5014)
* Create ArrayRightRotationTest.java

* Create ArrayRightRotation.java

* The updated one

* The updated one

* Added the test cases

* Added new test cases!

* Update ArrayRightRotation.java

* Update ArrayRightRotationTest.java
2024-01-13 13:59:30 +05:30
Piotr Idzik
19b7a22ec9
Remove unused imports from BoyerMooreTest (#5012) 2024-01-10 20:31:38 +02:00
mpousmali
fd84b0b10e
Add SRTF Algorithm (#5011) 2024-01-08 23:48:11 +02:00
Piotr Idzik
570f7e7ef6
Remove unused import (#5010) 2024-01-08 23:44:32 +02:00
Nishant Jain
bb2fff0cbb
Add package name (#5007) 2024-01-08 15:41:14 +02:00
Nishant Jain
0c881e39f2
Simplify minimizing lateness (#4999) 2024-01-08 15:34:36 +02:00
Piotr Idzik
8930ab5b16
Cleanup SumOfDigits and its tests (#4994) 2024-01-05 23:05:52 +02:00
Piotr Idzik
1ea95ffa92
Cleanup PerfectSquare and its tests (#4992) 2024-01-04 12:56:48 +02:00
Piotr Idzik
092ac5795b
Remove SetKthBit in favor of SingleBitOperations.setBit (#4991) 2024-01-04 00:28:59 +02:00
AthinaSw
6a0c0585e4
Add cross-correlation and auto-correlation (#4984) 2024-01-03 20:11:07 +02:00
Govind Gupta
9bef5a169c
Add Playfair Cipher (#4988) 2024-01-03 15:14:38 +02:00
Nishant Jain
a7d140a43e
Add Set Kth Bit (#4990) 2024-01-02 20:18:01 +02:00
aryan1165
7ece806cf5
Remove duplicate file of Simple Substitution Cipher (fixes #4494) (#4495) 2023-12-26 00:24:28 +02:00
Niklas Hoefflin
e26fd9da71
Add OR-Set (Observed-Remove Set) (#4980) 2023-12-11 23:05:43 +02:00
Niklas Hoefflin
4aa8e6a0eb
Updated TwoPSet to use Generics instead of Strings (#4981) 2023-12-11 20:58:56 +02:00
Niklas Hoefflin
b8b1dea38d
Add LWW Element Set (Last Write Wins Element Set) (#4979) 2023-12-08 20:57:07 +02:00
Niklas Hoefflin
92131de377
Fix compare() for subset check (S.A ⊆ T.A) (#4978) 2023-12-07 18:06:56 +02:00
Niklas Hoefflin
249ee1dc99
Add 2P-Set (Two-Phase Set) for both addition and removal operations in distributed systems (#4977) 2023-12-07 17:23:22 +02:00
Nassor Shabataka
36580bac1e
Fix typo in NextGraterElement (#4976) 2023-12-06 09:37:58 +02:00
Niklas Hoefflin
e59a3b1ebb
Add G-Set (Grow-only Set) (#4975) 2023-12-05 20:39:18 +02:00
Niklas Hoefflin
3001620c1e
Add PN-Counter (#4974) 2023-12-04 18:22:02 +02:00
Niklas Hoefflin
e759544c33
Add Boruvka's algorithm to find Minimum Spanning Tree (#4964) 2023-12-02 19:53:17 +02:00
Piotr Idzik
9bebcee5c7
Make sumOfDigits long in HarshadNumber.isHarshad (#4973)
fix: make `sumOfDigits` `long` in `HarshadNumber.isHarshad`
2023-11-30 22:06:31 +05:30
Piotr Idzik
fc21a8bffe
Explicitly cast result of Math.pow to long in Armstrong (#4972) 2023-11-30 10:50:09 +02:00
Piotr Idzik
f8de290188
Explicitly cast result of Math.pow to int in BinaryToHexadecimal (#4970) 2023-11-29 23:30:59 +02:00
Piotr Idzik
361b4108ee
Use explicit cast to int in FractionalKnapsack (#4971) 2023-11-29 23:21:25 +02:00
Doksanbir
1518e84fb9
Add Tribonacci Numbers (fixes #4646) (#4959) 2023-11-26 13:34:13 +02:00
Niklas Hoefflin
b1efd4e34b
Add G-Counter (Grow-only Counter) (#4965) 2023-11-24 19:13:44 +02:00
D.Sunil
c527dff92d
Add Javadoc comments (#4745) 2023-11-11 22:55:48 +02:00
Prathamesh Powar
574138c7a3
Cleanup BoyerMoore (#4951)
* modify code to make use of java Optional class

* revert changes

* add java.util.Optional<Integer>

* add java.util.Optional

* refactors: make `findmajor` return `optional`

* refactors: make method name findMajor and split it

* refactors: change method name in tests

* Apply suggestions from code review

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* change back to int

* fix: swap arguments

* tests: add some test cases

* refactor: add `isMajority` and avoid rounding

* style: use `var`

* style: swap arguments of `countOccurrences`

---------

Co-authored-by: vil02 <vil02@o2.pl>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-31 09:07:59 +01:00
Hardik Pawar
d086afce09
Enhance code density and readability (#4914)
* Enhance code density and readability

* Add wiki link

---------

Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
2023-10-30 23:18:05 +01:00
Phuong Nguyen
e5f3d232c9
refactor: use method SortUtils.swap (#4946)
* refactor: use method SortUtils.swap

* fix: clang format

* style: explicitly import `swap`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-30 23:09:43 +01:00
Satvik Singh Sengar
945e7b56bb
Fix:/Number of count of major element in Boyer Moore algorithm (#4728)
* Number of count of major element in Boyer Moore algorithm

* test: add `BoyerMooreTest`

* style: basic linting

* tests: add test case from the issue

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
2023-10-30 18:24:23 +01:00
Anup Omkar
9dde8a7808
Add MatrixRank (#4571)
* feat: adding matrix rank algorithm

* fix: formatting

* fix: adding comments, refactor and handling edge cases

* refactor: minor refactor

* enhancement: check matrix validity

* refactor: minor refactor and fixes

* Update src/main/java/com/thealgorithms/maths/MatrixRank.java

* feat: add unit test to check if input matrix is not modified while calculating the rank

---------

Co-authored-by: Anup Omkar <anup_omkar@intuit.com>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2023-10-25 15:34:05 +02:00
Aakil Iqbal
a4711d61d8
Added MapReduce Algorithm in Misc Folder. (#4828)
* Added MapReduce Algorithm in Misc Folder.

* Did formatting correctly

* Removed main function and added MapReduceTest

* format the code
2023-10-25 09:30:18 +05:30
Appari Satya Barghav
9dae389faa
Herons : Changed the signature of the function (#4686)
* Made changes to the code to correct the Logic of Armstrong Number

* Resolved the issues

* Trying to resolve the Linter error by changing Variable name

* Changed Variable Names : trying to resolve Clang error

* Chnged the signature of the function

* Added the Function documentation

* Added exception for parameters

* Resolved with suggested changes

* Resolved with Suggested changes

* fix: use proper logic

---------

Co-authored-by: vil02 <vil02@o2.pl>
2023-10-23 23:09:42 +02:00
Aditi Bansal
e87036d886
Correct documentation of IsEven (#4845)
* Update IsEven.java

* Update IsEven.java

* Update IsEven.java

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-19 21:37:29 +02:00
ironspec07
f3345d9e06
Fixed typo error for better readability (#4835) 2023-10-20 00:32:27 +05:30
Ayoub Chegraoui
8002137b76
Fixed some typos and links for javadoc, and some refactoring (#4755) 2023-10-15 19:32:24 +05:30
Lukas
48ae88f09d
Bit swap (#4770)
* Create BitSwap.java

* Create BitSwapTest.java

* Update BitSwap.java

* Update BitSwap.java

* Update BitSwapTest.java

* Update BitSwap.java

* Update BitSwap.java

* Update BitSwapTest.java

* Update BitSwapTest.java

* Update src/main/java/com/thealgorithms/bitmanipulation/BitSwap.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/bitmanipulation/BitSwapTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update BitSwap.java

* Update BitSwap.java

* Update BitSwap.java

* Update src/main/java/com/thealgorithms/bitmanipulation/BitSwap.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/bitmanipulation/BitSwap.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/bitmanipulation/BitSwapTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* style: remove redundant blank line

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-15 07:03:25 +00:00
Pronay Debnath
24a8223062
Added [FEATURE REQUEST] Golden Ration formula to find Nth Fibonacci number #4505 (#4513)
* Create FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Create FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Delete src/main/java/com/thealgorithms/maths/FibonacciNumberTest.java

* Create FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Create FibonacciCalculator.java

* Update FibonacciNumberTest.java

* Update and rename FibonacciCalculator.java to FibCalc.java

* Update FibonacciNumberTest.java

* Update FibCalc.java

* Update FibonacciNumber.java

* Delete src/test/java/com/thealgorithms/maths/FibCalc.java

* Create FibCalc.java

* Update FibonacciNumberTest.java

* Update FibCalc.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumber.java

* fix: use proper name

* fix: use proper class name

* tests: add `returnsCorrectValues`

* Update and rename FibCalc.java to Fibonacci.java

* Update Fibonacci.java

* Update FibonacciNumber.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update Fibonacci.java

* Update FibonacciNumber.java

* Update and rename FibCalcTest.java to FibonacciTest.java

* Update FibonacciNumber.java

* Update Fibonacci.java

* Update Fibonacci.java

* Update Fibonacci.java

* Update FibonacciTest.java

* Update Fibonacci.java

* Update src/main/java/com/thealgorithms/maths/Fibonacci.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FibonacciTest.java

* Update FibonacciNumberTest.java

* Update FibonacciNumberTest.java

* Update FibonacciTest.java

* Update src/main/java/com/thealgorithms/maths/Fibonacci.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/Fibonacci.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FibonacciNumber.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FibonacciNumberTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FibonacciNumber.java

* Update FibonacciNumber.java

* Update Fibonacci.java

* Update FibonacciNumber.java

* Update and rename FibonacciNumber.java to FibonacciNumberGoldenRation.java

* Update and rename FibonacciNumberTest.java to FibonacciNumberGoldenRationTest.java

* Update Fibonacci.java

* Update FibonacciNumberGoldenRation.java

* Update FibonacciNumberGoldenRationTest.java

* Update FibonacciTest.java

* Update Fibonacci.java

* Update FibonacciNumberGoldenRationTest.java

* Update FibonacciNumberGoldenRationTest.java

* Update FibonacciNumberGoldenRation.java

* Update FibonacciNumberGoldenRation.java

* Update FibonacciNumberGoldenRationTest.java

* Update FibonacciNumberGoldenRationTest.java

* Update src/main/java/com/thealgorithms/maths/FibonacciNumberGoldenRation.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update and rename Fibonacci.java to FibonacciLoop.java

* Update FibonacciNumberGoldenRation.java

* Update FibonacciNumberGoldenRationTest.java

* Update and rename FibonacciTest.java to FibonacciLoopTest.java

* Update FibonacciLoop.java

* Update FibonacciLoop.java

* Update FibonacciNumberGoldenRation.java

* docs: add missing dot

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
2023-10-13 21:23:30 +02:00
D.Sunil
1dc64b1685
Update BinarySearch (#4747) 2023-10-12 23:13:32 +03:00
Ricardo Ramos
e9bbf35ff9
Add FloorTest and clean-up Floor (#4769)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Ricardo Ramos <0102016812@grupotel.corp>
2023-10-12 00:21:53 +03:00
Abhinav Pandey
152e29034d
Improved code readability and code quality (#4663)
* Fixed Small typos :-)

* Update BufferedReader.java

* Made the following changes :

* Improved readability of files and removed gramatical errors.

* Implemented data assigning instead of manually calling arr.ylength in several instances like FindMax, FindMaxRecursion etc.

* Removed unwanted params from several files

* Implemented Math methods in files math/FindMinRecursion.java and FindMaxRecursion.java

* Update src/main/java/com/thealgorithms/maths/FindMinRecursion.java

---------

Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
2023-10-11 17:29:55 +05:30
Lukas
17fe4298b6
Add MaxValueTest and remove main from MaxValue (#4756)
* Create MaxValueTest.java

* Update MaxValue.java
2023-10-10 21:27:23 +02:00
Anuj Rathour
ced9678699
Update queue readme (#4721) 2023-10-09 18:33:34 +03:00
Lukas
c6a22de12f
Add MinValueTest and remove main from MinValue (#4713)
* Update MinValue.java

* Create MinValueTest.java

* Revert "Create MinValueTest.java"

* Create MinValueTest.java

* Update MinValueTest.java

* Update MinValueTest.java

* Update MinValue.java

* Update src/test/java/com/thealgorithms/maths/MinValueTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/MinValueTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/MinValue.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-09 17:17:02 +02:00
Prabhat-Kumar
8200a791a2
Add AhoCorasick (#4465)
* Added code to find Articulation Points and Bridges

* tried to solve clang-formant test

* removed new line at EOF to get lint to pass

* feature: Added Ahocorasick Algorithm

* fixed lint using clang-format

* removed datastructures/graphs/ArticulationPointsAndBridge.java from this branch

* removed main, since test-file is added. Also modified and renamed few functions.

* Added test-file for AhoCorasick Algorithm

* Modified some comments in test-file

* Modified some comments in AhoCorasick.java

* lint fix

* added few more test cases

* Modified some comments

* Change all class fields to private, added initializeSuffixLinksForChildNodesOfTheRoot() method, hashmap string search position (also has previous index based search), removed java.util.*

* Added Missing Test-Cases and more

* minor text changes

* added direct test check i.e. defining a variable expected and just checking if res and expected are equal.

* Created New Class Trie, merged 'buildTrie and buildSuffixAndOutputLinks' with 'Trie constructor'. Merged setUpStartPoints with searchIn. Now AhoCorasick contains -> inner class: Trie, Node. Methods: search and convert. Trie has -> Methods : constructor and searchIn

* Updated TestFile according to the updated AhoCorasick Class. Added Few more test cases

* updated - broken down constructor to relavent parts, made string final, made res local to searchIn(), doxygen-like style

* lint fix clang

* Updated Tests Files

* Added final field to Node class setters and Trie Constructor arguments, removed getTrieRoot() and some unnecessory comments, renamed [old -> new]: res -> positionByStringIndexValue, removed if condition from setupStartPoints()

* updated test file

* lint fix clang

* minor chage - 'removed a comment'

* added final fields to some arguments, class and variables, added a method initializePositionByStringIndexValue()

* updated to remove * inclusion and added the required modules only

* Implemented a new class PatternPositionRecorder to wrap up the position recording in searchIn()

* Added final fields to PatternPositionRecorder Class

* style: mark default constructor of `AhoCorasick` as `private`

* style: remoce redundant `public`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-08 15:16:06 +02:00
Aman
06aa834fa6
Enhance queue README.md (#4710) 2023-10-08 10:47:35 +03:00
Anuj Rathour
7f9555bd94
Update stack readme.md (#4678) 2023-10-07 20:37:57 +03:00
Piyush Pagar
aaa2b26ed1
Issue #4706 Solved (#4707)
Import Package into the RecursiveBinarySearchTest and RecursiveBinarySearch

Co-authored-by: PiyushPagar1 <piyus.p@ergobite.com>
2023-10-07 18:57:46 +05:30
Suchi Bansal
081f308b9d
Add ReverseWordsInString (#4456)
* return a string of the words in reverse order concatenated by a single space.

Input: s = "the sky is blue"
Output: "blue is sky the"

* return a string of the words in reverse order concatenated by a single space.

Input: s = "the sky is blue"
Output: "blue is sky the"

* space reduce

* removed main method

* added test cases

* formatting fix

* formatting fix

* worked on pr reviews

* formatting fix

* private constructor added

* added test case for when string contains white space

* simplified method

* fix issue

* formatting issues fix

* fixed issue

* code refactor

* documented method

* worked on pr comments

* docs: add missing space

* tests: express as `ParameterizedTest`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
2023-10-06 20:15:27 +02:00
Lukas
064ca8f591
cleanup FindMinRecursion (#4568)
* Create FindMinRecusionTest.java

* Update FindMinRecursion.java

* Update FindMinRecursion.java

* Update FindMinRecursion.java

* Rename FindMinRecusionTest.java to FindMinRecursionTest.java

* Update FindMinRecursionTest.java

* style: remove unused imports

---------

Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
2023-10-05 22:01:27 +02:00
Aman
06d6e2116b
Update Readme.md (#4634) 2023-10-05 16:08:28 +03:00
Appari Satya Barghav
a3a2d845d5
Made changes to the code to correct the Logic of Armstrong Number (#4619)
* Made changes to the code to correct the Logic of Armstrong Number

* Resolved the issues

* Trying to resolve the Linter error by changing Variable name

* Changed Variable Names : trying to resolve Clang error
2023-10-04 20:02:49 +05:30
Arin
4fab7adfaa
code-clean-up (#4519)
* code-clean-up

* style: make `RabinKarpAlgorithm` a proper utility class

---------

Co-authored-by: arintripathi1 <arint@trainee.nrifintech.com>
Co-authored-by: vil02 <vil02@o2.pl>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-03 17:32:59 +00:00
Vineet Chotaliya
535230acae
Add Greedy Algorithms (fixes #4493) (#4504) 2023-10-03 20:30:18 +03:00
Aman
329cc3bcf9
Added MirrorOfMatrix.java (#4461)
* Added MirrorOfMatrix.java

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Fixing Linting Issue

* Changes Done

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Changes Done

* Added MirrorOfMatrixTest.java

* Added MirrorOfMatrixTest.java

* Linting Error in Test

* Linting Error in Test

* Linting Error in Test

* trying to fix build error

* trying to fix build error

* final

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/misc/MirrorOfMatrixTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/misc/MirrorOfMatrixTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/misc/MirrorOfMatrixTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Changing Description

* Final

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Final

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Changes

* Changes

* Linting Issue

* Linting Issue

* Linting Issue

* Changes

* Fixing Minor Linting Issue

* Fixing Minor Linting Issue

* Final

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Changes

* Linting Issue

* Linting Issue

* Linting Issue

* Linting Issue

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/misc/MirrorOfMatrix.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Changes

* Changes

* fix: use proper size in `checkInput`

* style: basic linting

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
Co-authored-by: vil02 <vil02@o2.pl>
2023-10-03 16:42:56 +00:00
Shreyash Kashyap
9795bada90
Update Readme.md (#4561) 2023-10-03 14:22:19 +00:00
Bama Charan Chhandogi
5f5a61de87
Add median of matrix (#4590) 2023-10-03 17:16:14 +03:00
Bama Charan Chhandogi
536978919d
Add reverse k group in LinkedList algorithm (#4532) 2023-10-03 09:43:49 +03:00
Lukas
8dc5505323
Add FindMaxRecursionTest (#4431)
* Update FindMaxRecursion.java

* Create FindMaxRecusionTest.java

* Update and rename FindMaxRecusionTest.java to FindMaxRecursionTest.java

* Update FindMaxRecursion.java

* Update FindMaxRecursion.java

* Update src/test/java/com/thealgorithms/maths/FindMaxRecursionTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/maths/FindMaxRecursionTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/maths/FindMaxRecursion.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FindMaxRecursion.java

* Update FindMaxRecursionTest.java

* Update FindMaxRecursionTest.java

* Update FindMaxRecursion.java

* Update src/main/java/com/thealgorithms/maths/FindMaxRecursion.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update FindMaxRecursion.java

* Update FindMaxRecursion.java

* Update FindMaxRecursion.java

* Update FindMaxRecursion.java

* Update FindMaxRecursion.java

* Update src/main/java/com/thealgorithms/maths/FindMaxRecursion.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-01 18:21:29 +00:00
Arin
f72b80b116
rewrote as parameterized tests (#4458)
* rewrote as parameterized tests

* formatting issue resolved

* added test with different prime number q

* style: run `clang-format`

* tests: add missing test case

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-01 18:05:27 +02:00
Prabhat-Kumar
edb0489440
[FEATURE] #4486 QuickSort Algo for LinkedList (#4487)
* Added code to find Articulation Points and Bridges

* tried to solve clang-formant test

* removed new line at EOF to get lint to pass

* feature: Added Ahocorasick Algorithm

* fixed lint using clang-format

* Added QuickSort Algorithm for linked list

* removed datastructures/graphs/ArticulationPointsAndBridges and string/AhoCorasick.java from this branch

* Added datastructures/lists/SinglyLinkedList class, Replaced ListNode class

* Modified some comments

* Added tests in QuickSortLinkedListsTest.java

* removed main as added a test file to test test-cases

* test file for QuickSortLinkedLinst.java
2023-10-01 16:01:32 +00:00
Bharath Sanjeevi T
37b3844b98
Add SecondMinMax (#4432)
* Added Second Min/Max program

* Clang-format-lint error resolved

* Clang-format-error 2

* Added Program to find Second Minimum/Maximum element

* Test File & few changes

* Clang-lint-error resolved

* Maven Build Error Resolved

* Clang-lint-error resolved

* Clang-lint-error resolved 2

* Changes Resolved

* Test Arguements are Streamed

* Clang-lint-error resolved

* incresed code reusability

* Added Program to find Second Min / Max

* Program to find Second Min / Max

* Program to find Second Minimum / Maximum

* Program to find Second Best Number

* style: mark `initialVal` as `final`

* style: resolve `MultipleVariableDeclarations`

Each variable declaration must be in its own statement.

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-10-01 15:28:37 +00:00
Pronay Debnath
da687c11cb
Added [FEATURE REQUEST] <Recursive Binary Search> #4457 (#4469)
* Create RecursiveBinarySearch.java

* Update RecursiveBinarySearch.java

* Update RecursiveBinarySearch.java

* Update RecursiveBinarySearch.java

* Update RecursiveBinarySearch.java

* Create ReverseArray.java

* Update RecursiveBinarySearch.java

* Update RecursiveBinarySearch.java

* Create RecursiveBinarySearchTest.java

* Update RecursiveBinarySearchTest.java

* Update RecursiveBinarySearchTest.java

* Delete src/main/java/com/thealgorithms/others/ReverseArray.java

* Update RecursiveBinarySearchTest.java

* Update RecursiveBinarySearchTest.java

* Create ReverseArray.java

* Delete src/main/java/com/thealgorithms/others/ReverseArray.java

* Update RecursiveBinarySearchTest.java

* Update RecursiveBinarySearch.java
2023-10-01 15:22:51 +00:00
ANKIT SAHA
ee2629c8ab
Update Pangram.java using Java Collections (#4479)
* Update Pangram.java using Java Collections

A simple separate function isPangramOrNot(String s) has been created which implements the Pangram checking of a string using Java Collection Framework approach.

* Update Pangram.java using Java Collections

* Updated some linting errors in Pangram.java

* Update src/main/java/com/thealgorithms/strings/Pangram.java

Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>

* Updated Pangram.java

Method name updated to - isPangramUsingSet(String s)

* Updated the testcases PangramTest.java

Successfully updated the testcases in this same PR branch

---------

Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
2023-10-01 16:28:13 +05:30
Lukas
e5d33f3565
Add SingleBitOperations (#4415)
* SingleBitOperators

* Tests

* Update SingleBitOperatorTest.java

* Update SingleBitOperators.java

* Update SingleBitOperators.java

* Update SingleBitOperators.java

* Update SingleBitOperatorTest.java

* deliting files

* Update SingleBitOperators.java

* Update SingleBitOperatorTest.java

* Update SingleBitOperators.java

* Update SingleBitOperators.java

* Update SingleBitOperatorTest.java

* Update SingleBitOperatorTest.java

* Update and rename SingleBitOperators.java to SingleBitOperator.java

* Update SingleBitOperatorTest.java

* Update SingleBitOperator.java

* Update SingleBitOperator.java

* Update SingleBitOperator.java

* style: declare private default constructor

* fix: remove `SetBitTest.java`

* Update and rename SingleBitOperator.java to SingleBitOperations.java

* Update SingleBitOperatorTest.java

* Update SingleBitOperations.java

* Update and rename SingleBitOperatorTest.java to SingleBitOperationsTest.java

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-30 10:06:45 +02:00
Arin
ea0eef128d
corrected test file name (#4422) 2023-09-28 18:30:41 +02:00
Janmesh Singh
566c27a996
WildcardMatching Added (#4404)
* Added WildcardMatching DP

* Wildcard Matching update

* Updated WildcardMatching

* Added WildcardMatchingTests

* WildcardMatching update

* Clang-formatting done

* WildcardMatching_Clang-formatting done

* WildcardMatching
2023-09-27 12:54:52 +03:00
Lukas
8583ca3b40
Changing MaxFindTest (#4406)
* Changing MaxFindTest

* Update FindMaxTest.java

* Update FindMaxTest.java

* Update FindMaxTest.java

* Apply suggestions from code review

- add test case with unsorted array,
- test FindMax

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-26 19:36:56 +00:00
Lukas
bf777fff8f
Remove array len + Math.min (#4405) 2023-09-26 18:31:16 +03:00
Piotr Idzik
02bac7e3d4
Add test case with minimum not at index 0 (#4403) 2023-09-26 08:41:27 +03:00
Lukas
cada67b1eb
Remove array len + Math.max (#4401) 2023-09-25 19:10:04 +00:00
Lukas
01157f299c
Add negative FindMinTest (#4388) 2023-09-25 18:38:54 +00:00
Manan Solanki
9d8a0f36cf
Optimize MinimumPathSum (#4400) 2023-09-25 14:25:16 +00:00
Piotr Idzik
d6024f9cd4
Make FindMin a proper utilty class (#4397) 2023-09-24 10:25:28 +00:00
Piotr Idzik
fa77b50ef9
style: make FindMax a proper utilty class (#4398) 2023-09-24 13:55:19 +05:30
Lukas
ad4be217d4
Update FindMax.java (#4396) 2023-09-24 09:11:36 +02:00
Lukas
c1476d796c
Make FindMin more efficient (#4389) 2023-09-24 06:26:05 +00:00
Ansh Shah
d3a32135dc
Make MedianOfRunningArray Generic (#4392) 2023-09-24 08:50:43 +03:00
Manan Solanki
8803b1ead5
#4387 Enhance Minimum sum partition problem implementation (#4394)
* Enhance Minimum sum partition problem implementation

* Linter resolved

* Linter resolved

* Code review comments

* Code review comments

* Add validation for non-negative numbers

* Linter resolved

* style: fix formiatting

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-23 10:26:14 +02:00
Ansh Shah
fbe348b105
#4382 Bug Fix (#4384)
* #4382 Bug Fix

* #4382 Bug Fix

* Made Requested Changes

* Made Requested Changes

* Made Requested Changes

* Made Requested Changes

* Made Requested Changes

* Made Requested Changes

* Made Requested Changes

* Update src/main/java/com/thealgorithms/misc/MedianOfRunningArray.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/main/java/com/thealgorithms/misc/MedianOfRunningArray.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/misc/MedianOfRunningArrayTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

* Update src/test/java/com/thealgorithms/misc/MedianOfRunningArrayTest.java

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-21 06:05:26 +00:00
Piotr Idzik
906cd87731
style: avoid wildcard imports (#4386)
* style: import `assertEquals` explicitly

* fix: import `assertThrows`
2023-09-20 23:08:37 +05:30
Manan Solanki
12b6c29243
#4367 Enhance Knapsack problem (#4368)
* Enhance Knapsack problem

* Linter solved

* Linter solved

* Remove DynamicProgrammingKnapsack file, duplicate of Knapsack file

* Add null input testcase

* Linter resolved

* Updated meaningful test names

* Add check for negative weightCapacity

* Linter resolved

* Linter resolved

* Add check for non-positive weight

* Linter resolved

* fix: use proper formatting

* fix: use proper formatting

* fix: use proper formatting (I hope this will work now)

Sorry for the previous mess.

* Code review comments

* Code review comments

* Code review comments

* Code review comments

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-19 19:53:53 +00:00
Subhradeep Bera
26c2465328
Moved StackPostfixNotation.java from the Others section to the Stack section (#4372)
* Moved StackPostfixNotation.java from the Others section to the Stack section

* Put all stack related algo in a separate stack directory in the algorithms directory. The stack directory under data-structures now only contains various implementations of the stack data structure.

* formatted files
2023-09-18 21:27:36 +02:00
Piotr Idzik
58c21c5756
refactor: simplify ParseInteger (#4376) 2023-09-16 21:57:03 +03:00
Manan Solanki
5bb54977fe
#4369 Enhance UniquePaths (#4373)
* Enhance UnquiePaths DP problem solution

* Update testcases

* Linter issue resolved

* Code review comments

* Code review comments

* Code review comments

* Code review comments

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-14 19:45:16 +02:00
Bama Charan Chhandogi
34cf6dab28
add two sum problem (#4364)
* add two sum problem

* linter solved

* linter solved

* improve code

* linter solved

* improve code

* mini linter solved

* update code

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2023-09-12 08:00:08 +00:00
Manan Solanki
94621fb63e
Enhancing DisjointSetUnion data structure (#4366)
* Enhancing DisjointSetUnion data structure

* Linter resolved

* Linter resolved

* Linter resolved

* Linter resolved

* Added next line

* added next Line

* Resolve review comments

---------

Co-authored-by: Bama Charan Chhandogi <b.c.chhandogi@gmail.com>
2023-09-10 22:30:35 +05:30
Piotr Idzik
c54b8cddf3
Fix formatting of FloodFill (#4361) 2023-09-09 21:48:02 +03:00
Manan Solanki
a88abb7ac2
Fix : Floodfill infinite recursion due to same color (#4359)
Fix : Floodfill infinite recursion due to same color
2023-09-09 20:07:59 +02:00
Abhinav Pandey
81f38174a6
Fix small typos (#4357) 2023-09-08 16:10:22 +03:00
Lukas
fbef4023d5
Add Clear Bit (#4355) 2023-09-07 21:16:02 +03:00
Lukas
29a864b5b3
Add SetBit to bitmanipulation (#4348) 2023-09-06 14:46:45 +00:00
Bama Charan Chhandogi
fc693e8b51
Add Highest Set Bit algorithm (#4330) 2023-09-05 20:19:23 +00:00
Bama Charan Chhandogi
09950d6097
Add Rotate a Linkedlist (#4345) 2023-09-02 19:32:28 +00:00
Punit Patel
a96ad84fac
Add different types of Mean (#4339) 2023-09-02 17:22:28 +00:00
Piotr Idzik
cfdbc413f1
Cleanup PalindromeSinglyLinkedList (#4336) 2023-09-02 17:05:10 +00:00
Piotr Idzik
f010a47608
chore: enforce InsertNewlineAtEOF in clang-format (#4343)
* style: insert newline at eof

* style: use `InsertNewlineAtEOF` in `clang-format`

* fix: use `clang-format-16`

* chore: update clang-format-lint-action to v0.16.2

---------

Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
2023-09-01 04:10:46 +00:00
Piotr Idzik
ea15f2bd98
Make SinglyLinkedList Iterable (#4334) 2023-08-28 07:11:07 +00:00
Bama Charan Chhandogi
80a4435038
Add tests for power using recursion algorithm (#4335) 2023-08-28 07:03:27 +00:00
tomkrata
ebd356e182
Add Miller-Rabin Primality Test (#4329) 2023-08-27 20:07:27 +00:00
Piotr Idzik
8d9c49dafe
Add PalindromeSinglyLinkedListTest (#4327) 2023-08-24 17:49:02 +00:00
Bama Charan Chhandogi
b4f786369b
Add find non repeating number algorithm (#4328) 2023-08-24 20:36:12 +03:00
Bama Charan Chhandogi
52f365a915
Add Index Of Right Most Set Bit Test (#4325)
* add Index Of Right Most Set Bit Test

* clang linter solved
2023-08-23 11:14:53 +05:30
Bama Charan Chhandogi
4bcddd323c
Add Preemptive Priority Scheduling Algorithm (#4323) 2023-08-20 19:40:23 +00:00
SwargaRajDutta
af80c8005d
Add Sliding Window Problem (#4322) 2023-08-18 14:08:40 +00:00
Bama Charan Chhandogi
b61faf4ede
Is power two algo added. (#4321)
* is power two algo added

* Linter solved

* Update src/main/java/com/thealgorithms/bitmanipulation/IsPowerTwo.java

* Update src/test/java/com/thealgorithms/bitmanipulation/IsPowerTwoTest.java

---------

Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
Co-authored-by: Debasish Biswas <debasishbsws.dev@gmail.com>
2023-08-18 12:53:09 +00:00
EdsTomato
68fdec5977
Add Tests for PancakeSort (#4318) 2023-08-16 18:57:36 +03:00
EdsTomato
ac14411b39
Add Tests for GnomeSort (#4315) 2023-08-15 16:39:12 +00:00
Bama Charan Chhandogi
2c16c86054
Add Numbers Have Different Signs (#4317)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-15 19:36:00 +03:00
Snir Turgeman
18848574be
Make DFS and BFS search algorithms generic (fixes #4229) (#4230) 2023-08-13 11:59:26 +05:30
Bama Charan Chhandogi
1ef700e850
Add IsEven Algorithm (#4301)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-12 23:06:39 +03:00
Bama Charan Chhandogi
251157059c
Add Reverse Bits Algo in Bit-Manipulation (#4299)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-12 15:55:10 +00:00
Himesh Kohad
07945c7704
Add StrobogrammaticNumber (#4278) 2023-08-11 12:22:14 +00:00
Bama Charan Chhandogi
4fe419ebd8
Add Recursive Reverse of Linked List (#4292)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-10 11:38:56 +03:00
Bama Charan Chhandogi
1ef5208b75
Add M-coloring Problem (#4282)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-05 22:00:26 +03:00
Piotr Idzik
c4a9ef1566
Add PowerOfTwoOrNotTest (#4279) 2023-08-04 12:31:47 +00:00
Piotr Idzik
ee23b6c2e5
Add tests for GenericRoot (#4276) 2023-08-03 23:14:59 +03:00
Piotr Idzik
087d523ed0
Make Factorial a proper utility class (#4267) 2023-07-29 08:15:03 +03:00
Albina Gimaletdinova
f83008d80a
Refactor factorial, add unit tests (#4266) 2023-07-28 22:02:04 +03:00
Ranjeet Kumar Jena
cc9afea036
Fix formatting (#4259)
Co-authored-by: Ranjeet Kumar Jena <ranjeetjena06@gmai.com>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2023-07-27 08:50:47 +05:30
Piotr Idzik
de50fc0294
Simplify StackPostfixNotation.postfixEvaluate (#4264) 2023-07-26 20:16:52 +03:00
Albina Gimaletdinova
fc274c84f8
Fix style in AmicableNumbers (#4263) 2023-07-26 16:52:46 +03:00
Piotr Idzik
e5c7a08874
Handle inputs like "2 +" in StackPostfixNotation (#4262) 2023-07-26 14:11:28 +03:00
Piotr Idzik
44dcebb699
Handle incorrect inputs in StackPostfixNotation (#4261) 2023-07-26 06:20:56 +00:00
Albina Gimaletdinova
dec3b98e4b
Refactor FibonacciJavaStreams and add unit tests (#4260) 2023-07-25 22:42:09 +03:00
Ranjeet Kumar Jena
ef4ef42ed3
Remove duplicated lines (#4258)
Co-authored-by: Ranjeet Kumar Jena <ranjeetjena06@gmai.com>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2023-07-25 13:36:00 +03:00
Piotr Idzik
3c80e262a7
Update ReverseNumber (#4257)
- removes an unused import,
- fixes the order of the of the _modifiers_ in the definition of the class `ReverseNumber`.
2023-07-25 14:14:59 +08:00
Piotr Idzik
06ef351987
Add tests for SumOfArithmeticSeries (#4256) 2023-07-24 19:25:40 +03:00
Piotr Idzik
e897a93166
Fix formatting of NthUglyNumber (#4248) 2023-07-23 11:16:35 +00:00
Ranjeet Kumar Jena
1afc4cc319
Make code more idiomatic (#4249) 2023-07-23 13:51:52 +03:00
HManiac74
2488a2ad51
Code cleanup (#4246) 2023-07-22 15:23:00 +00:00
ngominhtrint
4effd28d80
Add unit tests for Minimum Path Sum algorithm (#4233)
* Add unit tests for Minimum Path Sum algorithm

* fix lint issues

* fix lint issues

* fix clang lint issue
2023-07-09 22:54:00 +05:30
Albina Gimaletdinova
9ecc3aae59
Add a new implementation for CheckAnagrams (#4231) 2023-07-06 16:56:59 +03:00
Albina Gimaletdinova
2456d86432
Add unit tests for ParseInteger (#4228) 2023-07-02 11:31:55 +03:00
Albina Gimaletdinova
4b45ac7e71
Add unit tests for PalindromeNumber (#4227) 2023-07-01 18:29:10 +00:00
Albina Gimaletdinova
8862a4dea5
Add unit tests for FibonacciNumberCheck (#4225) 2023-07-01 20:52:52 +03:00
Albina Gimaletdinova
bc699b86e5
Refactor BinaryTreeIsBalanced algorithm (#4222) 2023-06-26 22:26:17 +08:00
THIRUMURUGAN
05ca93eace
Rename surfaceAreaTriangle for clarity (#4220) 2023-06-23 19:39:10 +03:00
Piotr Idzik
63739f4933
refactor: simplify HammingDistance (#4218)
* refactor: make HammingDistance an utility class

* tests: add some tests, simplify logic of some

* refator: simplify logic in HammingDistance

* style: remove logging messages
2023-06-21 21:11:13 +05:30
Piotr Idzik
7a3273ae1d
tests: add tests for SieveOfEratosthenes (#4217)
* tests: add tests for SieveOfEratosthenes

* feat: throw for inputs <= 0

* refactor: simplify logic in SieveOfEratosthenes.findPrimesTill

* refactor: make SieveOfEratosthenes a utility class

* docs: update docs, fix typo
2023-06-20 23:58:53 +05:30