Commit Graph

440 Commits

Author SHA1 Message Date
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