Commit Graph

440 Commits

Author SHA1 Message Date
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
Piotr Idzik
87d6083bac
Add tests for EulersFunction (#4216) 2023-06-19 20:46:54 +03:00
acbin
415a04ea7f
Add automatic linter (#4214) 2023-06-09 20:05:14 +08:00
acbin
00282efd8b
style: format code (#4212)
close #4204
2023-06-09 18:52:05 +08:00
Piotr Idzik
ad03086f54
Remove main and add tests for CountWords (#4210) 2023-06-02 16:28:33 +00:00
Piotr Idzik
22002c9939
Generalize NthUglyNumber (#4209) 2023-06-02 14:17:26 +03:00
Piotr Idzik
4bbc4bd69f
Refactor ReverseNumber (#4208) 2023-05-31 09:07:55 +03:00
Bama Charan Chhandogi
b6e78a45ac
Add Octal To Binary Converter (#4202) 2023-05-30 07:37:50 +00:00
Piotr Idzik
5d7a59654f
Refactor LowestBasePalindrome (#4207) 2023-05-29 23:05:23 +03:00
Piotr Idzik
96c1a96647
Fix empty input handling in FindMax (#4206) 2023-05-28 23:45:13 +03:00
Piotr Idzik
4f15149804
style: handle empty input array in FindMin.findMin (#4205)
* tests: add test case with mininum not being at the beginning

* style: throw IllegalArgumentException when input is empty

* style: use enhanced for loop

* docs: update doc-str
2023-05-28 16:38:44 +05:30
Piotr Idzik
e14b30b88c
Fix empty input handling in GCD (#4199) 2023-05-27 17:58:56 +03:00
Glib
36232a8373
Fix typo (#4197) 2023-05-23 09:38:44 +03:00
Indrranil Pawar
9ce275c16d
Update FibonacciNumber.java (#4195) 2023-05-21 11:08:54 +05:30
Albina Gimaletdinova
deef2ae445
Refactor CreateBinaryTreeFromInorderPreorder (#4190) 2023-05-14 14:52:30 +03:00
Anirudh Pathak
0255705388
Add WordSearch (#4189) 2023-05-12 22:44:16 +03:00
Anirudh Pathak
de2696d0c5
Add Null/Empty check for param in average method (#4185) 2023-05-10 19:30:41 +03:00
Md. Asif Joardar
122f5e5556
Add Round Robin scheduling (#4184) 2023-05-10 16:04:55 +03:00
Md. Asif Joardar
3109c11c59
Add Partition Problem (#4182) 2023-05-09 13:21:11 +03:00
Albina Gimaletdinova
3a593d5d3c
Cover BSTRecursive with tests (#4180) 2023-05-06 21:10:33 +03:00
Manoj Kumar
89b7ee42e6
Add one more solution for anagrams check (#4175) 2023-05-05 20:50:47 +03:00
Rutikpatil0123
bb830e9559
Add tests for TwoSumProblem and reduce duplication (fixes #4177) (#4176) 2023-05-02 20:03:21 +03:00
Aditya Pal
fb18c27905
Add wiki link for DES (#4173) 2023-04-30 22:22:19 +03:00
Aditya Pal
19bd2408ff
Des (#4172)
* Update directory

* Add DES Encryption algorithm

* Update directory

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-30 20:19:14 +05:30
Rutikpatil0123
db9c78a598
Remove duplicated ThreeSum problem (fixes #4169) (#4170) 2023-04-29 10:17:00 +03:00
Rutikpatil0123
7ed65b0a1e
Add climbing stairs (#4168) 2023-04-28 20:34:15 +03:00
Lieu Chi Tung
b55fc972ac
Add tests for HorspoolSearch (#4165) 2023-04-25 14:04:15 +03:00
Albina Gimaletdinova
f69cd7cfa2
Remove redundant code and add tests for BSTIterative (#4164) 2023-04-24 14:52:38 +03:00
Albina Gimaletdinova
4c18e60671
Refactor BSTFromSortedArray (#4162) 2023-04-22 07:53:12 +00:00