35 Commits

Author SHA1 Message Date
79b93d35b6 style: remove redundant eslint suppressions (#1667) 2024-06-12 01:40:48 +05:30
d920e7f427 refactor: reduce code duplication in FloodFill (#1645)
* tests: add tests checking if floodFill funtions throw when location is outside

* refactor: reduce code duplication by adding `checkLocation` to `FloodFill`

* refactor: add and use `isInside`

Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com>

* Deduplicate further

---------

Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com>
2024-04-03 20:54:06 +05:30
bd34e9fa61 feat: remove duplicated gcd-like functions (#1642)
* feat: remove duplicated `gcd`-like functions

* Updated Documentation in README.md

---------

Co-authored-by: vil02 <vil02@users.noreply.github.com>
2024-03-16 09:29:14 +05:30
1b66d86bd7 Implemented Palindrome Partitioning using Backtracking algorithm (#1591)
* Implemented Palindrome Partitioning using Backtracking algorithm

* fix:Updated palindromePartition algorithm

* code clean up

* Rephrase doc comment & move to appropriate function

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-11-28 09:58:32 +05:30
e9e3ea4684 Implemented Partition Problem, Recursive problem (#1582)
* Add Tug of War solution using backtracking

* Updated Documentation in README.md

* Added Tug of war problem link

* Updated Documentation in README.md

* Updated Documentation in README.md

* Refactor tugOfWar: remove unused vars, optimize initialization, and remove redundant checks

* Added Function Export Statment

* Updated Documentation in README.md

* Resolved Code Style --Prettier

* Rename "backtrack" to "recurse"

* Fix test case: The difference needs to be exactly 1.

* Code Modification: subsets should have sizes as close to n/2 as possible

* Updated test-case of TugOfWar

* Changed TugOfWar problem to Partition

* Modified partition problem

* Updated Documentation in README.md

* fixed code style

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-11-15 19:22:57 +05:30
9a875264cc prettier fixes & added test cases for Project Euler problem 4 (#1566)
* 📦 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

* 👌 IMPROVE: Added test cases for Project Euler Problem 4

* 👌 IMPROVE: auto prettier fixes

---------

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2023-10-24 19:19:37 +02:00
60443c7eff test: add tests for Binary Equivalent Algorithm (#1560)
* test: add tests for Binary Equivalent Algorithm

* test: Refactored tests using .each()

* Update BinaryEquivalent.test.js

---------

Co-authored-by: {Harshit Malpotra} <{malpotra.harshit@gmail.com}>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-22 17:40:53 +00:00
96d122f29e fix: Enhance error handling in factorial function (#1430) 2023-10-05 15:30:28 +05:30
86d333ee94 feat: Test running overhaul, switch to Prettier & reformat everything (#1407)
* chore: Switch to Node 20 + Vitest

* chore: migrate to vitest mock functions

* chore: code style (switch to prettier)

* test: re-enable long-running test

Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime!

see #1193

* chore: code style

* chore: fix failing tests

* Updated Documentation in README.md

* Update contribution guidelines to state usage of Prettier

* fix: set prettier printWidth back to 80

* chore: apply updated code style automatically

* fix: set prettier line endings to lf again

* chore: apply updated code style automatically

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-04 02:38:19 +05:30
6debd5c1a2 chore: 🤖 remove extra lines (#1330)
I ran the command yarn style and that got failed, so I fixed that
2023-06-17 01:49:21 +05:30
5364a1c31b chore: check for invalid input to factorial (#1229) 2022-10-27 20:45:53 +02:00
63a3394d95 algorithm: letter combinations (#1209) 2022-10-21 16:54:37 +05:30
e32fdce52f Rename palindrome test to Palindrome to follow standard (#1159) 2022-10-10 11:29:26 +05:30
833d05d8d0 merge: binarySearch (#884)
* required, optional param left-to-right approch in BS

* base case return early to avoid nested if block

* codes formated with standard.js
2022-02-16 14:24:32 +05:30
6f1edd16f5 merge: Add test Case for Palindrome Recursive (#855)
* Add test Case for Palindrome Recursive

* Update Checks
2021-11-28 13:34:54 +05:30
027c0d6307 merge: Add test cases (#854) 2021-11-28 11:49:11 +05:30
51415f8a12 merge: Add test case (#851)
* Add test case

* minor fix

* delete files

* rename file
2021-11-27 12:58:18 +05:30
2fb0d48d94 merge: Add test cases, optamization of code, and Add description of function (#848)
* Add test cases, optamization of code, and Add description of function

* update testcase
2021-11-26 22:08:43 +05:30
1cef191494 merge: Made all tests follow file strcture convention already in-place (#820)
* add empty line to end of file

* Move all test files to /test following convention
2021-10-28 10:00:04 +05:30
5f45b540b9 Remove live code & console.log, leave examples as comments (ProjectEuler, Recursive). 2021-10-10 18:18:25 +02:00
b13b12e88c chore: merge Fix/742 migrate doctest to jest (#749)
* Remove QuickSelect doctest

There are more Jest test cases already.

* Remove AverageMedian doctest

Already migrated to jest

* Migrate doctest for BinaryExponentiationRecursive.js

(also remove inline "main" test method)

* Migrate doctest for EulersTotient.js

(also remove inline "main" test method)

* Migrate doctest for PrimeFactors.js

(also remove inline "main" test method)

* Migrate doctest for BogoSort.js

Re-write prototype-polluting helper methods, too.

(also remove inline test driver code)

* Migrate doctest for BeadSort.js

(also remove inline test driver code)

* Migrate doctest for BucketSort.js

(also remove inline test driver code)

* Migrate doctest for CocktailShakerSort.js

(also remove inline test driver code)

* Migrate doctest for MergeSort.js

(also remove inline test driver code)

* Migrate doctest for QuickSort.js

(also remove inline test driver code)

* Migrate doctest for ReverseString.js

(also remove inline test driver code)

* Migrate doctest for ReverseString.js

* Migrate doctest for ValidateEmail.js

* Migrate doctest for ConwaysGameOfLife.js

(remove the animate code, too)

* Remove TernarySearch doctest

Already migrated to jest

* Migrate doctest for BubbleSort.js

(also remove inline test driver code)

* Remove doctest from CI and from dependencies

relates to #742
fixes #586

* Migrate doctest for RgbHsvConversion.js

* Add --fix option to "standard" npm script

* Migrate doctest for BreadthFirstSearch.js

(also remove inline test driver code)

* Migrate doctest for BreadthFirstShortestPath.js

(also remove inline test driver code)

* Migrate doctest for EulerMethod.js

(also remove inline test driver code)

Move manual test-code for plotting stuff in the browser in a distinct file, too. Those "*.manual-test.js" files are excluded from the UpdateDirectory.mjs script, as well.

* Migrate doctest for Mandelbrot.js

(also remove inline test driver code & moved manual drawing test into a *.manual-test.js)

* Migrate doctest for FloodFill.js

* Migrate doctest for KochSnowflake.js

(also move manual drawing test into a *.manual-test.js)

* Update npm lockfile

* Update README and COMMITTING with a few bits & bobs regarding testing & code quality
2021-10-07 12:33:38 +05:30
966349741b removed tab error from BinaryEquivalent file in Recursive 2021-08-19 15:41:36 +05:30
1d381c5032 added BinaryEquivalent file in Recursive 2021-08-19 14:50:01 +05:30
eb3c325b53 Update Recursive/SubsequenceRecursive.js
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-08-17 09:44:31 +05:30
57a52aa6e6 added subsequenceRecursive.js file under Recursion 2021-08-17 00:12:58 +05:30
2b2cbfe284 add FloodFill.js 2021-05-28 17:05:55 +02:00
1dee811133 add KochSnowflake.js 2021-04-01 22:22:42 +05:30
cd7111a015 Added tests & normal function convertion (#445)
* added factorial calculator recursively

* added tests and converted to normal function

* Added tests & normal function convertion

* Update factorialCalculator.js

updated code "design" not sure why test fails on such arbitrary things.

* Update and rename factorialCalculator.js to factorial.js

Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-10-14 07:32:26 +05:30
29d21300cc Merge pull request #453 from malihassan20/binary-search-recursive-algorithm
binary search recursive algorithm added
2020-10-12 00:54:25 +05:30
19612236ab binary search recursive algorithm added 2020-10-10 23:24:29 +05:00
bc76dad28f palindrome-recursive-algorithm-added (#450) 2020-10-10 23:17:39 +05:30
c419ff5a1f npx fixx (#421) 2020-10-06 00:23:53 +05:30
2bb330e68b Create FibonacciNumberRecursive.js (#380)
* Create FibonacciNumberRecursive.js

* Update FibonacciNumberRecursive.js

Co-authored-by: vinayak <itssvinayak@gmail.com>
2020-10-05 23:52:52 +05:30
3ffacdff32 towerOfHanoi added (#312)
Co-authored-by: Aayushadh <ayushharwani2011@gmail.com>
2020-10-02 00:07:18 +05:30
9000e1caaa Re-orgainze files and folders in the repository (#172)
* Re-orgainze files and folders in the repository

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-18 11:10:07 +05:30