Commit Graph

1666 Commits

Author SHA1 Message Date
syedjafer_k
18baef8e7e feat: insertion sort with binary search (#1182) 2022-10-16 10:47:18 +02:00
Matheus Muriel
8c847e3aea solution: Project Euler Problem 13 (#1173)
* Included Project Euler 13 solution

* Fix review comments

* Fix style

* fix for code review

* fix the review

* Fix Style

Co-authored-by: Matheus Muriel <Matheus_MurielFerreira@swissre.com>
2022-10-15 15:01:02 +05:30
Omkarnath Parida
4df1e9e90e tests: Project Euler Problem 1 (#1161)
* 📦 NEW: Added solution for ProjectEuler-007

* 🐛 FIX: Spelling mistake fixes

* 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input

* 👌 IMPROVE: Modified the code

* 👌 IMPROVE: Added test case for ProjectEuler Problem001

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2022-10-15 14:58:06 +05:30
Matheus Muriel
36c6a4d29b solution: Project Euler Problem 11 (#1172)
* Included Project Euler 11 solution

* Fix review comments

Co-authored-by: Matheus Muriel <Matheus_MurielFerreira@swissre.com>
2022-10-15 14:56:15 +05:30
Chetan Patil
0df72642a5 algorithm: count the numbers divisible by ‘M’ in a given range (#1185)
*  test cases added for count divisible

*  count divisible math algorithm added

* style fixes
2022-10-15 14:52:44 +05:30
Changi Cho
45f0b7cae6 algorithm: check if integer is palindrome (#1177)
* feat: Add check number case

* style: Fix formatting

* fix: Remove number check part

* feat: Create isPalindromeIntegerNumber

* test: Add minus number case
2022-10-15 14:44:44 +05:30
ddaniel27
148ebd6625 algorithm: Project Euler Problem 44 (#1188)
* [CREATE] Problem 044 from Project Euler

* [UPDATE] Code styling update

* [UPDATE] Change return condition, added an input for main function,
added tests for problem 44

* [UPDATE] minor styling fixes to standard javascript

* [UPDATE] Fix parentheses in main function return
2022-10-15 14:38:48 +05:30
Roland Hummel
bd7de6a010 chore: Remove unused deps, clean up package.json a bit (#1176) 2022-10-13 17:27:05 +02:00
Chanchal Kumar Mishra
32b9a9900e Swapsort algorithm and corresponding tests (#1152) 2022-10-13 17:26:31 +05:30
SudhanshuSuman
10079a7b70 Renamed NQueen file, variables to NQueens, raised RangeError exception (#1162) 2022-10-13 17:22:59 +05:30
Chetan Patil
5a6b1d0d9e feat: Project Euler Problem 17 (#1168) 2022-10-13 10:42:56 +02:00
Prashal Ruchiranga
564ee8527a Add an algorithm to find mean absolute deviation (#1165) 2022-10-12 10:26:09 +05:30
Adhiraj
514c7c4c9f feat: added Project Euler Problem 13 (#1150) 2022-10-12 10:24:09 +05:30
Chetan Patil
d94929ea0d fix: DateToDay (#1125) 2022-10-10 11:31:58 +05:30
Matt Chapman
e32fdce52f Rename palindrome test to Palindrome to follow standard (#1159) 2022-10-10 11:29:26 +05:30
Omar Ferreiro
ede60b81d9 algorithm: catalan numbers (#1149) 2022-10-09 17:45:26 +05:30
acarlson
78f023fdd1 algorithm: Log2 using bitwise operations (#1132) 2022-10-09 17:36:23 +05:30
Anton Yakutovich
56713e8f43 Upgrade actions in Ci.yml workflow (#1153) 2022-10-09 17:35:06 +05:30
Omar Ferreiro
907b86c343 Rename to CaesarCipher (#1144) 2022-10-08 19:47:04 +05:30
Omkarnath Parida
d0e61e1f69 solution: ProjectEuler-007 (#1142)
* 📦 NEW: Added solution for ProjectEuler-007

* 🐛 FIX: Spelling mistake fixes

* 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input

* 👌 IMPROVE: Modified the code

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2022-10-08 12:27:02 +05:30
Prashal Ruchiranga
109e4a685b algorithm: find length of an arc and area of the sector formed by an arc of a circle (#1119)
* Add an algorithm to find length and area of an arc of a circle

* Updated to follow Javascript Standard Style

* Update CircularArc.js

* Update CircularArc.js

* Add tests

* Followed Javascript standard style
2022-10-08 12:26:06 +05:30
Abdul Ahad Khan
8461271fc8 added check for Integer (#1137) 2022-10-07 17:16:28 +05:30
Ivan Barsukov
b71815d50c Fix grammar mistakes in JSDoc (#1127) 2022-10-07 10:51:54 +05:30
ABDUL || JS & PY
9a3d64c91f chore: add instruction for installing dependencies (#1120) 2022-10-07 10:50:52 +05:30
Omar Ferreiro
23adfc76d9 algorithm: Minesweeper (#1129) 2022-10-07 10:45:25 +05:30
AditiJain2826
c365e82d08 Adding testcases for Boyer Moore Algorithm (#1135) 2022-10-07 10:44:11 +05:30
JCarlos
ea7d06ad57 tests: Levenshtein Distance (dynamic programming solution) (#1114) 2022-10-06 00:38:23 +05:30
Nitin Ramnani
9528c71107 Added testcases for Zero One Knapsack (#1109) 2022-10-02 11:19:31 +05:30
k ho k ho?
7a1141b637 refactor: BFS tree algorithms (#1108)
* Bugfix AVLTree comparator

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.

* 100% jest code coverage

Added a couple of extra elements to the original test tree, and then removed elements in an order such that all previously uncovered branches of code are now covered.

Also added an emptyTree structure to test some additional (trivial) base cases.

* standard style fix

missed this from my previous commit

* Iterative & in-place BFS

An iterative analog to the traditional recursive breadth-first-search algorithm for binary trees.

This in-place solution uses the pre-existing "traversal" array for both tracking the algorithm as well as storing the result.

Also tweaked old code by resetting the traversal array each time the tree is traversed (otherwise you're only allowed to traverse a tree once which doesn't seem correct even with a single traversal function).

* Update BreadthFirstTreeTraversal.js

got rid of unnecessary currentSize
added currentNode for clarity

* refactor out traversal member var

.. per earlier discussion w mods
also tweaked the tests to achieve 100% coverage
2022-09-25 13:41:00 +05:30
k ho k ho?
7ab9792f16 algorithm: Iterative (and in-place) BFS for binary trees (#1102)
* Bugfix AVLTree comparator

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.

* 100% jest code coverage

Added a couple of extra elements to the original test tree, and then removed elements in an order such that all previously uncovered branches of code are now covered.

Also added an emptyTree structure to test some additional (trivial) base cases.

* standard style fix

missed this from my previous commit

* Iterative & in-place BFS

An iterative analog to the traditional recursive breadth-first-search algorithm for binary trees.

This in-place solution uses the pre-existing "traversal" array for both tracking the algorithm as well as storing the result.

Also tweaked old code by resetting the traversal array each time the tree is traversed (otherwise you're only allowed to traverse a tree once which doesn't seem correct even with a single traversal function).

* Update BreadthFirstTreeTraversal.js

got rid of unnecessary currentSize
added currentNode for clarity
2022-09-22 17:24:29 +05:30
Kartik Kapgate
9bcf16ba4b refactor: RotateListRight.js and added tests (#1101)
* Refactored RotatedListRight.js and added its tests

* rotateListRight test and improved implementation

* Review changes on constructor's loop
2022-09-22 17:22:11 +05:30
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