218 Commits

Author SHA1 Message Date
f3613382aa Add All Paths from Source to Target (fixes #3359) (#3873) 2023-02-28 12:46:17 +02:00
3499c1bee6 Add postorder binary tree traversal (#3899) 2023-02-27 12:06:39 +00:00
b98dc2c5b5 Fix linear probing hash map (#3902) 2023-02-26 21:15:48 +00:00
45923d6872 Add inorder binary tree traversal (#3898) 2023-02-25 20:58:06 +00:00
6d13d95e41 Graham scan algorithm (#3903)
* Added Graham scan algorithm #3894

* Added Graham scan algorithm (#3894)

---------

Co-authored-by: Stronshade <diegobrocker1999@gmail.com>
2023-02-25 18:31:51 +05:30
6b9eb1b9c1 Add orderAgnosticBinarySearch (#3882)
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2023-02-23 17:19:05 +00:00
3c0d94292c Add Introspective Search (#3887) 2023-02-19 21:50:59 +02:00
541f490d1e Valid BST: refactoring + added unit test (#3883)
Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2023-02-17 11:43:17 +00:00
d565edc69a Added recursive&iterative preorder binary tree traversal (#3884)
Added recursive& iterative preorder binary tree traversal
2023-02-17 17:04:44 +05:30
e0b1235bef Fix ArrayIndexOutOfBoundsException in LevenshteinDistance (#3871) 2023-02-15 20:34:36 +00:00
69a428470c Add Tarjans Algorithm (#3874) 2023-02-15 20:27:21 +00:00
a584ca248c Refactor Level Order Traversal (#3869) 2023-02-14 12:33:14 +02:00
c0fec8dfe2 Add Optimal Job Scheduling (#3868) 2023-02-08 18:09:38 +00:00
39df47b5f2 Add Kosaraju Algorithm (#3859) 2023-02-08 18:05:52 +00:00
54d6f79acd Add SimpleSubstitutionCipherTest (#3857) 2023-01-17 22:05:24 +02:00
b14f55096d Fix LFUCache (#3847) 2023-01-15 11:28:16 +02:00
b6c1d250f4 Add Conway Sequence (#3807)
Co-authored-by: Bruno Eloi <bruno.eloi@minfin.fed.be>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2023-01-14 12:22:15 +02:00
d5f140458a Add two algorithms with matrixes (#3364) 2023-01-14 10:01:03 +00:00
351e85d264 Added same trees algorithm check with a unit test (#3845)
Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2023-01-13 20:07:56 +00:00
44c05bf7db Add Shortest Job First Scheduling (#3843) 2023-01-13 21:22:45 +02:00
3b6e3edbfb Vertical order traversal refactoring, added unit test (#3844)
Vertical order traversal refactoring, added test
2023-01-13 19:26:15 +05:30
5aa417b6ae Added Zigzag Traversal of a Binary Tree (#3811)
* Added Zigzag Traversal of a Binary Tree

* fixed file name

Co-authored-by: Albina Gimaletdinova <gimaletdinovaalbina@gmail.com>
2023-01-12 17:36:11 +05:30
64181d6ea7 Remove unnecessary import (#3809) 2023-01-10 09:30:22 +02:00
1eedaeb073 Move common tests for sorting algorithms to the base test class (#3782)
* bug fix for CircularBuffer + refactoring + add unit tests

* change Insertion sort to classical implementation + add isSorted function to SortUtils + add SortUtilsRandomGenerator for generating random values and arrays

* little fix

* move all common tests to SortingAlgorithmTest and utilize them

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2023-01-01 14:50:56 +00:00
9123474729 Add Leftist Heap (#3789)
Co-authored-by: Adrian Paras <aparas@terpmail.umd.edu>
2022-12-29 12:19:35 +00:00
6a0035d872 Add description for SkipList.java (#3503) 2022-12-28 12:01:05 +00:00
c6694fc1bd Simplifying boolean returns (#3796)
* Simplifying boolean returns

* add comment back
2022-12-18 03:03:09 +00:00
5512fea0a8 Improve priority queues with max-heap (#3648) 2022-12-13 20:02:15 +02:00
8ba295b1ad Added Order Agnostic Binary Search problem in Searches folder. (#3791)
* Added Order Agnostic Binary Search problem

* Update OrderAgnosticBinSearch.java

* Added JUnit Tests and removed redundant code.

* Made minor changes in JUnit Tests

* Removed tests for main folder and added docs.

* Added OrderAgnosticBinarySearchTest.java

* Renamed file to avoid errors.

* Updated the file to avoid build error
2022-12-12 00:43:27 +05:30
3f7e4d3f8f Simplify Tim Sort (#3780) 2022-11-30 19:05:13 +02:00
6c9090ffed Create BucketSortTest (#3779)
* Create BucketSortTest

* Update src/test/java/com/thealgorithms/sorts/BucketSortTest.java

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

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-28 15:15:06 +05:30
7692e8f47d Heap Sort: Simplify (#3777)
* bug fix for CircularBuffer + refactoring + add unit tests

* change Insertion sort to classical implementation + add isSorted function to SortUtils + add SortUtilsRandomGenerator for generating random values and arrays

* little fix

* simplify heap sort

* Update src/main/java/com/thealgorithms/sorts/HeapSort.java

* Update src/main/java/com/thealgorithms/sorts/HeapSort.java

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-25 22:33:04 +05:30
72468cc707 MergeSort: Simplify merge function (#3774)
* bug fix for CircularBuffer + refactoring + add unit tests

* change Insertion sort to classical implementation + add isSorted function to SortUtils + add SortUtilsRandomGenerator for generating random values and arrays

* little fix

* simplify merge function in MergeSort

* refactor one-liners

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-25 03:54:17 +05:30
260f1b2bee Remove duplicate KnapsackMemoization (#3769) 2022-11-19 13:32:01 +02:00
f7dee0d958 Add tests for recursive merge sort (#3510) 2022-11-12 16:10:13 +00:00
b294ddcb38 Add AliquotSum (#3765) 2022-11-11 21:57:18 +02:00
9cde14095c Fix BFS (#3759) 2022-11-09 19:40:20 +00:00
4990f791a6 Add Bead Sort (#3761) 2022-11-09 19:33:30 +00:00
b8d6b1a9b0 Create CRC16.java (#3733)
* Create CRC16.java

* Create CRC16Test.java
2022-11-09 10:20:54 +05:30
eb375a6015 Fix spelling (#3444) 2022-11-07 18:31:44 +00:00
b75dce17c3 algorithm: Square free integer (#3760)
* feat: Add square free integer implementation

Closes #3402

* test: Add unit tests for square free integer

Closes #3402

* fix: Fix failing build

Changed static import for assertEquals()
Closes #3402
2022-11-07 14:31:44 +05:30
58cf08f2fd Modify Insertion sort implementation to classical one + add function insertion-sentinel sort. (#3622)
* bug fix for CircularBuffer + refactoring + add unit tests

* change Insertion sort to classical implementation + add isSorted function to SortUtils + add SortUtilsRandomGenerator for generating random values and arrays

* little fix

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-06 17:54:08 +05:30
c8ecd23183 Constructors BigInteger and BigDecimal used to wrap primitives should never be used. (#3627)
Constructors BigInteger and BigDecimal used to wrap primitives should never be used.

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-06 17:40:14 +05:30
cc17d60d5c Add unit tests for SimpleSubCipher (#3688) 2022-11-06 10:21:22 +00:00
1c7da7af25 Add LongDivision (#3691) 2022-11-06 12:18:14 +02:00
37a1659e18 Add HarshadNumberTest (#3722) 2022-11-03 12:59:13 +00:00
37db41fd6b Add AutomorphicNumber (#3735) 2022-11-03 12:55:48 +00:00
1a391c2fe9 Add ValidParentheses (#3689) 2022-11-01 19:26:13 +02:00
fea982d54d Create Atoi Function.java (#3756)
* Create MyAtoi.java

There is a method in C++, which converts String to an Integer, called Atoi function, this is my own implementation of this function.

* Update directory

* Update MyAtoi.java

* Create MyAtoiTest.java

* Update directory

* Update directory

* Update directory

* Update MyAtoi.java

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-01 16:34:14 +05:30
d418bbd1cf Created PerfectNumberTest.java & Added function in PerfectNumber.java (#3751)
* Added function in PerfectNumber.java

Added isPerfectNumber2() in PerfectNumber.java

* Created PerfectNumberTest.java

* fixed isPerfectNumber()

fixed bug in isPerfectNumber() for negative numbers

* fixed typo

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-11-01 06:22:56 +00:00