943 Commits

Author SHA1 Message Date
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
9e7456a2a8 Add tests for merge sort (#3715) 2022-10-31 19:26:49 +00:00
3542f1c4c1 Add check if tree is symmetric or not (fixes #3471) (#3472)
Co-authored-by: Amit Kumar <akumar@indeed.com>
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2022-10-30 10:29:22 +02:00
23eec39a29 Fibonacci optimized using binet's formula (#3728)
* Fibonacci optimized using binet's formula

* Update Fibonacci.java

* Update Fibonacci.java

* updated changes

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-10-30 09:26:08 +05:30
8efc71e609 Added functions in Perimeter.java (#3739)
* Added functions and removed main

* deleted perimeterTest.java

deleted perimeterTest.java to create PerimeterTest.java

* Recreated PerimeterTest.java

Renamed perimeterTest.java to PerimeterTest.java and added test cases

* deleted PerimeterTest.java

* Recreated PerimeterTest.java

Recreated PerimeterTest.java from perimeterTest.java
2022-10-30 09:22:25 +05:30
957f633c93 Added function and fixed bug in PerfectCube.java (#3655)
* Added another function to PerfectCube.java

Added another function to PerfectCube.java and fixed a testing mistake in line number 9

* Created PerfectCubeTest.java

Created PerfectCubeTest.java

* fixed PerfectCubeTest.java

* Fixed bug in PerfectCube.java

Fixed bug in PerfectCube.java in isPerfectCube() function for negative numbers. Now It gives the correct output for perfect negative numbers.

* removed main() in PerfectCube.java
2022-10-29 11:57:17 +05:30
5ab1b6c319 Created VolumeTest.java & Fixed Bugs in Volume.java (#3682)
* Fixed functions and removed main() in Volume.java

Fixed calculation errors in volumeSphere() and volumeHemisphere() functions and removed main() and changed functions access specifier from private to public

* Created VolumeTest.java

Created VolumeTest.java JUnit Tests for Volume.java

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-10-28 00:35:59 +05:30
bd267bb7d8 Fixed error in Palindrome.java and gave semantic names to functions (#3643)
* fixed error and changed functions names

fixed error at line 57 and gave semantic names to functions with comments

* renamed functions

renamed functions to match with original functions' names in the file

* Updated TestCases

Updated TestCases and changed a function name

* Removed main() and changed function name

Removed main() and changed the function name from isPalindromeStringBuilder to isPalindrome

* fixed typo

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-10-28 00:17:16 +05:30
acf7a86b96 Added function in Pangram.java (#3703)
* Added function in Pangram.java

Added isPangramIndexOf() function in Pangram.java

* Added Tests for new function

Added Tests for isPangramIndexOf() function

* fixed typo

* changed function name

* changed function name

Co-authored-by: Debasish Biswas <debasishbsws.abc@gmail.com>
2022-10-27 23:26:34 +05:30
b2393d62a0 Add Test case for EggDropping (#3687) 2022-10-27 20:52:45 +03:00
23949cac47 Add test case for BinaryToDecimal (#3684) 2022-10-27 20:40:08 +08:00
2c9edc95b8 Add test case for HexaDecimalToBinary (#3683) 2022-10-27 20:34:01 +08:00
a0d03e814a Update WordLadderTest.java & WordLadder.java (#3674) 2022-10-26 21:14:03 +08:00
eecec0f706 Add test case for LetterCombinationsOfPhoneNumber (#3662) 2022-10-26 16:38:24 +08:00
c9e1d96147 Fix typos (#3615)
Co-authored-by: Andrii Siriak <siryaka@gmail.com>
2022-10-26 07:40:06 +00:00
8c6ed9c240 Add unit test for RSA cipher (#3664) 2022-10-26 09:10:27 +08:00
f8897f166d Add unit tests for Caesar cipher (#3665)
Co-authored-by: Yang Libin <contact@yanglibin.info>
2022-10-26 09:01:35 +08:00
7ef75980d5 Add unit tests for Vigenere cipher (#3666) 2022-10-26 08:57:51 +08:00
fd3386a0db Removed extra loop in Anagram.java (#3654) 2022-10-25 12:19:03 +00:00
315e947c87 Add more tests (#3601) 2022-10-25 12:15:41 +00:00
6235fd6505 Add tests for Average (#3652) 2022-10-25 15:00:53 +03:00
d88b70113f Fix naming LinkList_sort -> LinkListSort (#3640) 2022-10-24 21:27:17 +03:00
1e16709680 Update README.md (#3362) 2022-10-23 05:59:40 +00:00
8d4b048cb3 Add LongestValidParenthesesTest (#3612) 2022-10-22 19:21:54 +00:00
ea05286c86 Add tests for PowerSum (#3603) 2022-10-22 19:11:40 +00:00
3ef3d761c6 Add DP Solution to Subset Count (#3580) 2022-10-20 19:51:54 +00:00