1627 Commits

Author SHA1 Message Date
61c9e8b372 fix: factorial function (#1093) 2022-09-07 15:00:35 +05:30
6f55ed4a1f algorithm: mobius function implementation (#1088)
* feat: Add mobius function implementation

* test: Add tests for mobius function

* fix: Code style fixes

* fix: Code style fixes

* fix: Store prime factors in a variable &  add throw error

* fix: Fix unit tests for zero and negative numbers

* fix: Minor code style fixes
2022-09-06 15:25:28 +05:30
ad41e8cc1c fix: spellings which are making ci fail (#1089)
* Updated Documentation in README.md

* chore: remove wrong spelling

* ci: recognize "falsy" as correct spelling

* chore: fix spelling

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-09-05 11:06:24 +05:30
a133529122 merge: Bugfix AVLTree comparator (#1084)
The original insertBalance function was doing raw value comparisons as opposed to using the tree's comparator. This is clearly unintentional, and would (ultimately) cause the structure to segfault when constructed with the stringData included in the updated test.

I've added the fix, scanned the rest of the code for similar issues, and added the appropriate test case which passes successfully with the fix. The jest code coverage increases slightly as well with the changes.
2022-08-15 21:57:31 +05:30
979046897d merge: Edit Perfect{Square, Cube} (#1071)
* Make `PerfectCube` more correct and readable

* Add negative and Infinity tests

* Fixed comment formatting

* Realized BigInt support is unnecessary

The algorithm would be exactly the same, so there's no added educational value

* Update PerfectCube.js

* Remove space

* Update PerfectCube.js

Now `isInt` is replaced by `isFinite`, because `isInt` is a redundant check

* Update PerfectCube.js

Remove dot

* Parity between `PerfectSquare` and `PerfectCube`

* Update PerfectSquare.test.js

Fixed the old copy-paste error that said "cube" instead of "square". And added `Infinity` test
2022-08-12 23:14:25 +05:30
e9b8b136b9 merge: Implement Shor's factorization algorithm (#1070)
* Updated Documentation in README.md

* merge: Fix GetEuclidGCD (#1068) (#1069)

* Fix GetEuclidGCD

Implement the actual Euclidean Algorithm

* Replace == with ===

* Lua > JS

* Standard sucks

* Oops

* Update GetEuclidGCD.js

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>

* feat: implement Shor's Algorithm

* chore: add tests

* Updated Documentation in README.md

* chore: fix spelling

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-08-07 12:33:43 +05:30
4b07e8a79a Fix Affine-Cipher encrypt and drypt func (#1077) 2022-08-03 22:33:06 +05:30
cc16cbdf84 Added JugglerSequence.js (#1075) 2022-08-03 22:32:34 +05:30
a9e65cd865 Wrapping the example matrix with outer array (#1057) 2022-08-02 18:53:41 +05:30
1a089cc491 merge: Fix GetEuclidGCD (#1068)
* Fix GetEuclidGCD

Implement the actual Euclidean Algorithm

* Replace == with ===

* Lua > JS

* Standard sucks

* Oops

* Update GetEuclidGCD.js

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-27 18:43:07 +05:30
7d40bb4a29 merge: Add Affine Cipher (#1067)
* Add Affine Cipher

* Replace IndexOf function to improve performance

* remove leading spacing and fixed typo

* Remove leading spacing in first row.
2022-07-27 17:31:11 +05:30
bbbf343971 merge: Fix IsPalindrome Big-O analysis (#1054)
* Fix IsPalindrome Big-O analysis

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-01 22:52:04 +05:30
1b64ba68fa Fibonacci.js overhaul (#1049) 2022-06-27 10:09:54 +05:30
95a8ec08ed merge: More accurate error message at IsDivisible (#1048)
* More accurate error message

* Lowercased "R"
2022-06-21 22:47:45 +05:30
6b06b3a37f merge: Add new IsPalindrome implementation (#1046) 2022-06-16 22:28:59 +05:30
85f428e826 merge: Add test case to Interpolation Search Algorithm (#1045)
* Add test case to Interpolation Search Algorithm

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-13 22:17:18 +05:30
59760f75c4 merge: Add test case to Edit Distance Algorithm (#1044)
* Add test case to Edit Distance Algorithm

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-12 20:14:11 +05:30
f5be6b2daa merge: Add test case to Fibonacci Search Algorithm (#1042)
* Add test case to Fibonacci Search Algorithm

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-11 17:13:12 +05:30
15c20968ae merge: Add test case to jump search Algorithm (#1041)
* Add test case to jump search Algorithm

* Updated Documentation in README.md

* Remove commented code

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-10 20:32:47 +05:30
398b6822dc merge: Add test case to the Exponential Search Algorithm (#1040)
* Add test case to the Exponential Search Algorithm

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-07 21:13:03 +05:30
d3cec8b28f merge: Rename secondLargestElement.test.js to SecondLargestElement.test.js (#1039) 2022-06-06 14:02:12 +05:30
c105c4d0a2 merge: Rename pigeonHoleSort.test.js to PigeonHoleSort.test.js (#1038) 2022-06-05 22:29:06 +05:30
61ee22459b merge: Add test case to Find Second Largest Element Algorithm (#1037) 2022-06-05 08:51:58 +05:30
dbffac253d merge: FindSecondLargestElement: Support negative numbers (#1036)
* FindSecondLargestElement: Support negative numbers

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-06-03 22:37:49 +05:30
0dccd280f3 merge: fix typo(change file name) (#1034) 2022-06-02 12:03:04 +05:30
d59213d0b8 merge: Add test case to CheckPascalCase Algorithm (#1029) 2022-05-31 14:25:31 +05:30
162e90f3d2 merge: Add test case to palindromeRearranging Algorithm (#1030)
* Add test case to CheckPascalCase Algorithm

* Add test case to palindromeRearranging Algorithm

* no need
2022-05-31 14:24:57 +05:30
07e77fac1c merge: Add testcase to AlternativeStringArrange Algorithm (#1026)
* Add test case to HexToRGB algorithm

* Add testcase to AlternativeStringArrange Algorithm

* deleting coppy file
2022-05-30 19:50:04 +05:30
9befd923b1 Add testcase to checkKebabCase (#1027) 2022-05-30 16:18:42 +02:00
92a81a2290 merge: Add Twin Primes algorithm (#1024)
* Create TwinPrime.js

* Update TwinPrime.js

* Create TwinPrime.test.js

* Update TwinPrime.js

* Update TwinPrime.js

* Add suggestions

* Update TwinPrime.test.js

* Update TwinPrime.js

* Styling
2022-05-27 21:28:45 +05:30
0357a23282 merge: Add the Collatz Conjecture (#1022)
* Create CollatzConjecture.js

* Create CollatzConjecture.test.js

* Update CollatzConjecture.js

* Update CollatzConjecture.test.js

* Rename CollatzConjecture.js to CollatzSequence.js

* Update and rename CollatzConjecture.test.js to CollatzSequence.test.js

* Update CollatzSequence.js

* Update CollatzSequence.test.js

* Update CollatzSequence.test.js

* Fix styling errors

* Add suggestion

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>

* Update CollatzSequence.js

* Update CollatzSequence.js

* Update comments to match the Collatz Sequence

* Update CollatzSequence.test.js

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>
2022-05-26 08:37:53 +05:30
dc67506272 merge: Add pronic number implementation (#1023)
* feat: Add pronic number implementation

* Add test to Math

* Minor fixes

* Minor style fixes

* refactor: Store square root in a variable

* Minor refactoring

* fix: Change pronic number check logic

Reduced time complexity from O(sqrt(n)) to O(1)

* Minor style fixes

* fix: Update pronic number check boolean equation

* refactor: Change pronic number check condition

* refactor: Add tests to Math

* Minor style fixes

* refactor: Change unit test logic
2022-05-25 17:39:23 +05:30
d28ae8b1f7 merge: Update test case for bubbleSort ( with code style is fixed) (#1020)
* Update test case for bubbleSort

* re-update test case for bubble sort

* re-update test case for bubbleSort
2022-05-23 22:27:11 +05:30
360c447e72 merge: Add test case to HexToRGB algorithm (#1018) 2022-05-17 19:29:42 +05:30
4cd6fd4f1b merge: Add test case to Vigenere Cipher Algorithm (#1017) 2022-05-17 16:58:00 +05:30
c865654f27 Clean up phone number formatting (#1015) 2022-05-16 18:48:16 +02:00
f736217341 merge: Add test case to KeywordShiftedAlphabet algorithm (#1013) 2022-05-12 21:22:30 +05:30
21a851176d merge: Find max recursion (#1010)
* add yt video association algorithm

* Implement FindMaxRecursion in JS

* Delete file in other PR

* Fix requested changes

* Add requested changes

* Delete YoutubeVideoAssociation.test.js

* Deduplicate comment

* Remove trailing spaces

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-05-09 15:05:16 +05:30
cbc669aa9d merge: Upgraded Algorithm of alpha numeric palindrome (#1006)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: optimized algo n to n / 2 & replaced test cases

* chore: update node version

* chore: set node version to lts

* chore: updated the node version & added engines prop

* resolve: removed while loop

* chore: added right shift ops comment

* chore: update comment

* chore: removed abs

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2022-05-07 17:42:50 +05:30
e05b4432d8 merge: Improved the complexity of dequeue O(n) to O(1) (#1005)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: updated the Queue array to linkedlist DS

* chore: fixed grammer

* resolve: removed capacity related codes, & updated test cases

* feat: added length dicrease code on dequeue
2022-05-06 21:50:55 +05:30
03d0b1e0b8 merge: Update README.md (#1004) 2022-05-06 15:51:56 +05:30
edd7076e75 merge: A better README (#1003)
* feat: a better README

* chore: update repositories link

* chore: fix broken links

* chore: use gfm `<hr>` syntax

Replaced <hr> with ---, which is GitHub Flavoured Markdown syntax.

* chore: align everything to be centered

* feat: use same style for all badges

* chore: use shields.io badge instead of github

* chore: reorder badges and add comments

* chore: edit and format body

* chore: add redirect links to all images

* typo: JavasScript -> JavaScript
2022-05-06 13:46:34 +05:30
b81c339b59 merge: Improve pull request template (#1002) 2022-05-04 22:32:08 +05:30
28062533b6 merge: Upgrade max char (#983)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: added filter for alphabets only

* resolve: added empty validation improved ignore pattern

* chore: reverted to for of loop
2022-05-02 14:51:16 +05:30
e447b5545d merge: Update directory workflow (#1000)
* chore: update directory workflow

Workflow now only runs on `pull_request` to prevent pushing on the master branch.

* chore: update commit mechanism

* chore: remove rundundant script

* Update UpdateDirectory.yml

* Updated Documentation in README.md

* Update UpdateDirectory.yml

* fix: replace wrong variable

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-28 18:58:12 +05:30
01db0fb369 Fix wiggle sort (#991)
Co-authored-by: Antonia Strack <antonia.strack@thm.mni.de>
2022-04-28 12:16:13 +02:00
6d5e641e6e merge: tweak DIRECTORY.md generation (#999)
* tests: change extention of helper file

* chore: revert previous change

* chore: ignore dirs with name "test"

* docs: update directory styling

Removed headings from `DIRECTORY.md` generation.

* refactor: make code more idiomatic

* docs: format directories to be bold

* chore: change char conting method

* fix: add 1 to ident count
2022-04-28 15:43:45 +05:30
2e18fbb39a merge: Add the Stooge Sort Algorithm (#998)
* Add stooge sort sorting algorithm with included tests

* Add stooge sort sorting algorithm with included tests

* Add correct url for more information

* Add time complexity warning
2022-04-28 13:47:23 +05:30
5641b6faea Add Zeller's Congruence Algorithm in Math (#996) 2022-04-27 14:49:12 +02:00
7881cb5f16 Add Boyer-Moore string search algorithm (#990)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-23 13:06:41 +02:00