328 Commits

Author SHA1 Message Date
fa77b50ef9 style: make FindMax a proper utilty class (#4398) 2023-09-24 13:55:19 +05:30
ad4be217d4 Update FindMax.java (#4396) 2023-09-24 09:11:36 +02:00
c1476d796c Make FindMin more efficient (#4389) 2023-09-24 06:26:05 +00:00
d3a32135dc Make MedianOfRunningArray Generic (#4392) 2023-09-24 08:50:43 +03:00
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
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
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
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
58c21c5756 refactor: simplify ParseInteger (#4376) 2023-09-16 21:57:03 +03:00
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
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
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
c54b8cddf3 Fix formatting of FloodFill (#4361) 2023-09-09 21:48:02 +03:00
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
81f38174a6 Fix small typos (#4357) 2023-09-08 16:10:22 +03:00
fbef4023d5 Add Clear Bit (#4355) 2023-09-07 21:16:02 +03:00
29a864b5b3 Add SetBit to bitmanipulation (#4348) 2023-09-06 14:46:45 +00:00
fc693e8b51 Add Highest Set Bit algorithm (#4330) 2023-09-05 20:19:23 +00:00
09950d6097 Add Rotate a Linkedlist (#4345) 2023-09-02 19:32:28 +00:00
a96ad84fac Add different types of Mean (#4339) 2023-09-02 17:22:28 +00:00
cfdbc413f1 Cleanup PalindromeSinglyLinkedList (#4336) 2023-09-02 17:05:10 +00:00
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
ea15f2bd98 Make SinglyLinkedList Iterable (#4334) 2023-08-28 07:11:07 +00:00
80a4435038 Add tests for power using recursion algorithm (#4335) 2023-08-28 07:03:27 +00:00
ebd356e182 Add Miller-Rabin Primality Test (#4329) 2023-08-27 20:07:27 +00:00
b4f786369b Add find non repeating number algorithm (#4328) 2023-08-24 20:36:12 +03:00
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
4bcddd323c Add Preemptive Priority Scheduling Algorithm (#4323) 2023-08-20 19:40:23 +00:00
af80c8005d Add Sliding Window Problem (#4322) 2023-08-18 14:08:40 +00:00
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
2c16c86054 Add Numbers Have Different Signs (#4317)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-15 19:36:00 +03:00
18848574be Make DFS and BFS search algorithms generic (fixes #4229) (#4230) 2023-08-13 11:59:26 +05:30
1ef700e850 Add IsEven Algorithm (#4301)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-12 23:06:39 +03:00
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
07945c7704 Add StrobogrammaticNumber (#4278) 2023-08-11 12:22:14 +00:00
4fe419ebd8 Add Recursive Reverse of Linked List (#4292)
Co-authored-by: BamaCharanChhandogi <b.c.chhandogi@gmailcom>
2023-08-10 11:38:56 +03:00
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
c4a9ef1566 Add PowerOfTwoOrNotTest (#4279) 2023-08-04 12:31:47 +00:00
ee23b6c2e5 Add tests for GenericRoot (#4276) 2023-08-03 23:14:59 +03:00
087d523ed0 Make Factorial a proper utility class (#4267) 2023-07-29 08:15:03 +03:00
f83008d80a Refactor factorial, add unit tests (#4266) 2023-07-28 22:02:04 +03:00
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
de50fc0294 Simplify StackPostfixNotation.postfixEvaluate (#4264) 2023-07-26 20:16:52 +03:00
fc274c84f8 Fix style in AmicableNumbers (#4263) 2023-07-26 16:52:46 +03:00
e5c7a08874 Handle inputs like "2 +" in StackPostfixNotation (#4262) 2023-07-26 14:11:28 +03:00
44dcebb699 Handle incorrect inputs in StackPostfixNotation (#4261) 2023-07-26 06:20:56 +00:00
dec3b98e4b Refactor FibonacciJavaStreams and add unit tests (#4260) 2023-07-25 22:42:09 +03:00
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
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
06ef351987 Add tests for SumOfArithmeticSeries (#4256) 2023-07-24 19:25:40 +03:00