Commit Graph

2071 Commits

Author SHA1 Message Date
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
Piotr Idzik
6283572637
Ask contributors to create drafts (#4522) 2023-10-01 22:55:37 +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
Andrii Siriak
1cf193c7f4
Remove @siriak from CODEOWNERS 2023-09-27 10:10:03 +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
Andrii Siriak
a1844840fd
Add a note about leetcode to CONTRIBUTING.md 2023-09-17 23:43:55 +03: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
Andrii Siriak
77caf26033
Update CODEOWNERS 2023-09-07 21:17:08 +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
Piotr Idzik
72247ed85c
chore: update actions/setup-java to v3 (#4352)
chore: use `actions/setup-java@v3`
2023-09-05 11:19:26 +05:30
Piotr Idzik
40a0515054
Update actions/checkout to v4 (#4351) 2023-09-04 22:21:39 +03: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