Commit Graph

1635 Commits

Author SHA1 Message Date
Kartik Kapgate
d05bbf77c6 algorithm: first unique char in a string (#1103)
* feat: Added Algo first unique char in a string.

* Optimised algo to linear time complexity

* removed double quotes

* Review changes: if-else logic
2022-09-22 17:20:04 +05:30
Akshay Dubey
c7f9bf961c algorithm: Square free integer (#1104)
* feat: Add square free integer implementation

* test: Add unit tests for square free integer

* refactor: Remove trailing whitespace from line 27

* refactor: Fix comments
2022-09-22 17:18:36 +05:30
Kartik Kapgate
cf0593f430 Refactor Cycledetection.js and added it's test. (#1099) 2022-09-15 12:22:44 +05:30
Akshay Dubey
d1152144aa algorithm: Liouville function (#1100) 2022-09-15 12:20:58 +05:30
k ho k ho?
e7ee09a07d feat: AVLTree 100% test coverage (#1098) 2022-09-13 14:45:20 +05:30
Kartik Kapgate
6ad2467545 algorithm: find the middle of linked-list (#1096)
* Added Middle of linked-list implementation.

* Added Middle of LL function and tests

* Refactor: Added method in singly LL and its tests

* Refactor: Method name and inline test calls

* Use `!== null` instead of `!= null`

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-09-10 19:17:50 +05:30
Akshay Dubey
644d7f7faa Binomial coefficient implementation (#1094) 2022-09-08 10:14:33 +05:30
Ajinkya Chikhale
6c718c01d4 add: countSubstrings function implementation (#1091) 2022-09-07 15:03:24 +05:30
Akshay Dubey
61c9e8b372 fix: factorial function (#1093) 2022-09-07 15:00:35 +05:30
Akshay Dubey
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
Rak Laptudirm
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
k ho k ho?
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
Ricardo Fernández Serrata
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
Rak Laptudirm
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
shidian00
4b07e8a79a Fix Affine-Cipher encrypt and drypt func (#1077) 2022-08-03 22:33:06 +05:30
tehliang
cc16cbdf84 Added JugglerSequence.js (#1075) 2022-08-03 22:32:34 +05:30
Kasun Thennakoon
a9e65cd865 Wrapping the example matrix with outer array (#1057) 2022-08-02 18:53:41 +05:30
Lars Müller
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
shidian00
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
Lars Müller
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
Ricardo Fernández Serrata
1b64ba68fa Fibonacci.js overhaul (#1049) 2022-06-27 10:09:54 +05:30
Ricardo Fernández Serrata
95a8ec08ed merge: More accurate error message at IsDivisible (#1048)
* More accurate error message

* Lowercased "R"
2022-06-21 22:47:45 +05:30
Andrea Tota
6b06b3a37f merge: Add new IsPalindrome implementation (#1046) 2022-06-16 22:28:59 +05:30
Ankush263
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
Ankush263
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
Ankush263
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
Ankush263
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
Ankush263
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
Ankush263
d3cec8b28f merge: Rename secondLargestElement.test.js to SecondLargestElement.test.js (#1039) 2022-06-06 14:02:12 +05:30
Ankush263
c105c4d0a2 merge: Rename pigeonHoleSort.test.js to PigeonHoleSort.test.js (#1038) 2022-06-05 22:29:06 +05:30
Ankush263
61ee22459b merge: Add test case to Find Second Largest Element Algorithm (#1037) 2022-06-05 08:51:58 +05:30
Lars Müller
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
Ankush263
0dccd280f3 merge: fix typo(change file name) (#1034) 2022-06-02 12:03:04 +05:30
Ankush263
d59213d0b8 merge: Add test case to CheckPascalCase Algorithm (#1029) 2022-05-31 14:25:31 +05:30
Ankush263
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
Ankush263
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
Ankush263
9befd923b1 Add testcase to checkKebabCase (#1027) 2022-05-30 16:18:42 +02:00
Exortions
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
Exortions
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
Akshay Dubey
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
thanhphuonghdhh
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
Ankush263
360c447e72 merge: Add test case to HexToRGB algorithm (#1018) 2022-05-17 19:29:42 +05:30
Ankush263
4cd6fd4f1b merge: Add test case to Vigenere Cipher Algorithm (#1017) 2022-05-17 16:58:00 +05:30
Fahim Faisaal
c865654f27 Clean up phone number formatting (#1015) 2022-05-16 18:48:16 +02:00
Ankush263
f736217341 merge: Add test case to KeywordShiftedAlphabet algorithm (#1013) 2022-05-12 21:22:30 +05:30
Exortions
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
Fahim Faisaal
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 489544da0a.

* 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
Fahim Faisaal
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 489544da0a.

* 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
Olindo Zaman
03d0b1e0b8 merge: Update README.md (#1004) 2022-05-06 15:51:56 +05:30
Rak Laptudirm
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