46 Commits

Author SHA1 Message Date
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
00e40e6f06 Fix/code smells (#1338)
* ♻️ refactor: improving and fixing some code

* Updated Documentation in README.md

* ♻️ refactor: improving isLeapYear

* 🐛 chore: back changes

* 🐛 fix: using reduce instead forEach

* 🐛 fix: using reduce instead forEach

* 🐛 fix: removing duplicated code

* 🐛 chore: removing .js

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-21 23:36:43 +05:30
566d9103cd fix: refactor PrimMST and fix bug in PriorityQueue (#1300)
* ref: KeyPriorityQueue in separate  file #1298

* feat: add tests for KeyPriorityQueue #1298

* fix: _shiftDown refactored and corrected #1298

* fix: use KeyPriorityQueue in PrimMST #1298

* feat: add test for PrimMST #1298

* fix: format files #1298

* fix: minor coding style changes

* fix: use map for keys and priorities #1298
2023-02-23 20:05:45 +05:30
002b10a5aa docs: fix typos (#1283)
* docs: fix typos

* fix
2023-02-07 22:20:28 +05:30
b88128dd97 algorithm: LCA by binary lifting (#1237)
* algorithm: LCA by binary lifting

* removed trailing spaces

* reduced code duplication by importing code from other file

* made requested changes
2022-10-30 14:42:40 +05:30
d9d085faa7 algorithm: binary lifting (#1218)
* Algorithm: BinaryLifting

* Update BinaryLifting.js

* made the requested changes

* added more comments
2022-10-27 19:26:13 +05:30
945657a98f chore: use internal queue definition in BFS Shortest Path (#1230) 2022-10-27 18:45:33 +05:30
b24f1f61cb chore: use internal queue definition in BFS (#1228) 2022-10-27 11:41:39 +05:30
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
a9e65cd865 Wrapping the example matrix with outer array (#1057) 2022-08-02 18:53:41 +05:30
b30f9f36f5 chore: fix spelling
./Graphs/DepthFirstSearchRecursive.js:26: recursivly ==> recursively
2021-10-28 13:52:22 +05:30
df4a783b06 Complying with JavaScript Standard Style (npx standard --fix). 2021-10-11 15:49:24 +02:00
9212e6d684 Remove live code & console.log, leave examples as comments (Geometry, Graphs, Maths). 2021-10-10 17:55:08 +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
1589263947 fixed some spellings 2021-10-05 12:49:23 +05:30
d49cf9fead chore: Added BellmanFord (#679)
* Added BellmanFord

* Add References for BellmanFord

* Style code using standard.js

* Add tests and modify code

* Fixed BellmanFord test file

* Add BellmanFord and tests
2021-09-09 16:46:52 +05:30
aaee62b6aa Merge pull request #349 from c-utkarsh/add-floyd-warshall
Added FloydWarshall All Pairs Shortest Path Algo
2021-05-23 13:38:04 +05:30
3c3cae6e8a Merge pull request #572 from algobytewise/add-BreadthFirstShortestPath
Add algorithm Breadth-first shortest path
2021-02-28 08:48:34 +05:30
c1e0dcb036 fix: updated description comment 2021-02-28 08:44:38 +05:30
60dd4069e8 use set to keep track of visited nodes, updated description 2021-02-27 09:51:51 +05:30
853386fa97 use set to keep track of visited nodes, corresponding adjustments to doctest 2021-02-27 09:44:33 +05:30
d11df93cd0 Add algorithm Breadth-first shortest path 2021-02-25 15:28:52 +05:30
692c0dc91b add algorithm Breadth-first search 2021-02-25 15:22:35 +05:30
493aab4309 Removed anonymous function 2021-02-02 16:54:14 -03:00
d6cd367b25 Added density calculation 2021-01-23 15:56:09 -03:00
3a1d21a987 Corrected let to const 2021-01-18 20:56:58 -03:00
686ba7e8f9 Added suggestions and updated for loop 2021-01-18 20:54:44 -03:00
1d72cbb273 Update Graphs/NodeNeighbors.js
Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
2021-01-17 01:11:13 -03:00
7b15f66a86 Added JS standard 2021-01-06 17:37:19 -03:00
5946f987a9 Added wikipedia link 2021-01-06 17:13:52 -03:00
80fc69ef41 Added Node Neighbors 2021-01-06 17:10:09 -03:00
920f4b3b38 Added FloydWarshall All Pairs Shortest Path Algo 2020-10-02 13:28:18 +05:30
b06aa8733f Add number of islands 2020-10-01 21:50:05 -04:00
e3ee2b2675 add Number of Islands 2020-10-01 21:38:52 -04:00
b1b4c138a6 Changed var to const/let (#322)
* varToLet

* Update DijkstraSmallestPath.js

Co-authored-by: Aayushadh <ayushharwani2011@gmail.com>
2020-10-01 23:05:36 +05:30
df58a7ed5f Small Tweaks/Fixes (#235) 2020-08-01 09:11:19 +05:30
0fd1a19ba5 Created Tree Section + Moved Tree algorithm from into the folder (#236) 2020-07-28 21:46:56 +05:30
f21e460729 Added Kruskal's Algorithm (#232) 2020-07-23 20:55:21 +05:30
e20c99809e Added DFS (Iterative) - Graph (#229) 2020-07-19 10:22:10 +05:30
b5899d5294 Added DFS (Recursive) - Graph (#228) 2020-07-14 17:34:42 +05:30
6a80dc7179 Added Prim's Algoritm (#227) 2020-07-10 01:38:14 +05:30
f34fd6d8f0 Added Connected Components using DFS (#223) 2020-07-07 12:39:33 +05:30
0c3fd105c8 Rename DFS.js to DepthFirstSearch.js 2020-06-28 12:40:36 +05:30
269157f65b Added DFS Algorithm (#199)
* FibonacciSearch

* FibonacciSearch

* Depth First Search Algorithms

* Depth First Search Algorithms

* Depth First Search Algorithms

* Depth First Search Algorithms
2020-06-23 09:42:36 +05:30
37ab4b0752 rename and reorganizing (#194) 2020-06-20 10:26:44 +05:30
f75549f6d7 Created DijkstraSmallestPath.js in Graphs (#185)
* Created DijkstraSmallestPath.js in Graphs

* Deleted DijkstraSmallestPath.js from Maths
2020-06-20 10:09:07 +05:30