1683 Commits

Author SHA1 Message Date
ce9e2946be algorithm: kosaraju (#1215)
* kosaraju test added

* Fixes: #1214

* Fixes: #1214

* Update package-lock.json

* Kosaraju.js exports function kosaraju rather than class
2022-10-20 20:35:24 +05:30
6f9a8e4b5a added-ModularArithmetic-code (#1217)
* added-ModularArithmetic-code

* fix-typo

* suggested changes
2022-10-20 20:33:06 +05:30
cf482c4eef fix typo in FenwickTree.js (#1208) 2022-10-20 20:30:43 +05:30
21d73b6447 algorithm: unique paths (#1211)
* dp problem

* update Directory.md

* suggested changes
2022-10-20 20:29:36 +05:30
16fa774012 chore: only test changed packages (#1194) 2022-10-20 15:59:09 +02:00
73bf91d7e1 Add an algorithm to find Taylor series approximation of exponential f… (#1160) 2022-10-20 17:10:22 +05:30
58671861a5 algorithm: SegmentTree (#1178) 2022-10-20 17:09:37 +05:30
636017ca51 algorithm: reverse (#1197) 2022-10-20 17:08:56 +05:30
b07529fb6f tests: Project Euler Problem 3 (#1207) 2022-10-20 17:05:30 +05:30
0084acf2d4 algorithm: sieve (#1205) 2022-10-20 16:50:37 +05:30
55f502e1f1 algorithm: count letters (#1164) 2022-10-19 16:52:27 +05:30
ff606a019e chore: improve the Gitpod file (#1203)
* chore: improve the Gitpod file

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-17 16:56:18 -05:00
8b5d006c9b chore: update Discord invite link (#1202) 2022-10-17 19:26:25 +02:00
e65211299b feature: add fast fibonacci algorithm (#1155) 2022-10-17 01:54:44 +05:30
829d3fd807 solution: Project Euler Problem 28 (#1198) 2022-10-17 01:54:11 +05:30
2a62eabfd7 tests: Project Euler Problem 2 (#1200) 2022-10-17 01:52:29 +05:30
4ce3dbe6b4 dependencies: update and clean (and auto-fix style issues) (#1195)
* Update npm dependencies (and auto-fix style issues)

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-16 16:09:56 +05:30
18baef8e7e feat: insertion sort with binary search (#1182) 2022-10-16 10:47:18 +02:00
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
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
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
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
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
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
bd7de6a010 chore: Remove unused deps, clean up package.json a bit (#1176) 2022-10-13 17:27:05 +02:00
32b9a9900e Swapsort algorithm and corresponding tests (#1152) 2022-10-13 17:26:31 +05:30
10079a7b70 Renamed NQueen file, variables to NQueens, raised RangeError exception (#1162) 2022-10-13 17:22:59 +05:30
5a6b1d0d9e feat: Project Euler Problem 17 (#1168) 2022-10-13 10:42:56 +02:00
564ee8527a Add an algorithm to find mean absolute deviation (#1165) 2022-10-12 10:26:09 +05:30
514c7c4c9f feat: added Project Euler Problem 13 (#1150) 2022-10-12 10:24:09 +05:30
d94929ea0d fix: DateToDay (#1125) 2022-10-10 11:31:58 +05:30
e32fdce52f Rename palindrome test to Palindrome to follow standard (#1159) 2022-10-10 11:29:26 +05:30
ede60b81d9 algorithm: catalan numbers (#1149) 2022-10-09 17:45:26 +05:30
78f023fdd1 algorithm: Log2 using bitwise operations (#1132) 2022-10-09 17:36:23 +05:30
56713e8f43 Upgrade actions in Ci.yml workflow (#1153) 2022-10-09 17:35:06 +05:30
907b86c343 Rename to CaesarCipher (#1144) 2022-10-08 19:47:04 +05:30
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
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
8461271fc8 added check for Integer (#1137) 2022-10-07 17:16:28 +05:30
b71815d50c Fix grammar mistakes in JSDoc (#1127) 2022-10-07 10:51:54 +05:30
9a3d64c91f chore: add instruction for installing dependencies (#1120) 2022-10-07 10:50:52 +05:30
23adfc76d9 algorithm: Minesweeper (#1129) 2022-10-07 10:45:25 +05:30
c365e82d08 Adding testcases for Boyer Moore Algorithm (#1135) 2022-10-07 10:44:11 +05:30
ea7d06ad57 tests: Levenshtein Distance (dynamic programming solution) (#1114) 2022-10-06 00:38:23 +05:30
9528c71107 Added testcases for Zero One Knapsack (#1109) 2022-10-02 11:19:31 +05:30
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
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
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
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
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