42 Commits

Author SHA1 Message Date
85a55daf49 test: added for Linear Search Algorithm (#1753)
* test: added for Linear Search Algorithm

* Update Search/LinearSearch.js

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

---------

Co-authored-by: Hridyanshu7 <himank7794@gmail.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2024-12-20 21:35:50 +05:30
d74f242ac4 Rabin Karp Search Algorithm (#1545)
* Search: Rabin-Karp algorithm

* Prettier Style

* Search: Rabin-Karp adding reference

* Search: Rabin-Karp styling and remove unecessary logging

* Search: Rabin-Karp review notes

* Simplify return

* Updated Documentation in README.md

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-30 11:00:31 +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
628c5aeb5c chore: remove unnecessary code (#1531)
Co-authored-by: IcarusTheFly <IcarusTheFly@users.noreply.github.com>
2023-10-14 16:53:23 +00:00
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
b71815d50c Fix grammar mistakes in JSDoc (#1127) 2022-10-07 10:51:54 +05:30
23adfc76d9 algorithm: Minesweeper (#1129) 2022-10-07 10:45:25 +05:30
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
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
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
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
298ab3366c merge: Add proper tests for binary search (#987)
* feat: added alternative binary search

* fix: exchange "dir" for "high"

* fix : fixing code style

* fix: fixed readability

* fix: fixed code smells

* fix: remove binary search alternative

* feat: added tests of binary search interative and recursive

* fix: fixed wrong identation

* fix: refactoring duplicated code of tests
2022-04-21 11:37:20 +05:30
8a4f117574 merge: add UnionFind.js plus tests (#814)
* Create UnionFind.js

* Create UnionFindTest.js

* add UnionFind.js plus tests

* implement PR comments

* implement PR comment

* fix codestyle

Co-authored-by: Administrator <pi@pglp.noip.me>
2021-10-26 18:05:22 +05:30
df4a783b06 Complying with JavaScript Standard Style (npx standard --fix). 2021-10-11 15:49:24 +02:00
87a3da7e37 Remove console.log 2021-10-11 15:11:52 +02:00
90356f340d Exponential Search : Fix 'value' is not defined error . 2021-10-11 12:58:45 +02:00
74f296578a Search/Sorts algoruthms : remove live code & console.log, leave examples as comments. 2021-10-11 12:29:03 +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
3cae80e456 chore: merge "repulling all together (#694)"
* Create slidingWindow.js

* Rename slidingWindow.js to SlidingWindow.js

* update the commit
2021-09-22 21:40:45 +05:30
0182e31f74 Added TernarySearch Function 2021-07-24 22:48:18 +08:00
34a1eb2461 Merge pull request #333 from RitikDua/master
Added BinarySearchIterative Function
2021-05-23 14:27:08 +05:30
ca4c1a62af style: Fixed most styles (according to standardjs) 2021-05-21 11:16:11 +05:30
83b05cde15 style fixes 2020-10-31 17:53:08 +02:00
e424ba2a4f Added QuickSelect Algorithm 2020-10-31 17:33:26 +02:00
6d5b6095c0 Implemented FibonacciSearch Using JavaScript (#348)
* Implemented FibonacciSearch Using JavaScript

* Fixed Lint/test issues

* Fixed lint/test error

* FIxed Lint issues
2020-10-04 19:11:07 +05:30
e4faf7a85f Added StringSearch (#385)
* Added StringSearch

* fixed the standard issue
2020-10-03 23:34:13 +05:30
fdeda72805 Code Refacoring 2020-10-01 21:32:44 +05:30
b4648f7b93 Code Refacoring 2020-10-01 21:30:54 +05:30
c6a36987c8 Added BinarySearchIterative Function
* BinarySearchIterative Function is added
* BinarySearch function is renamed to BinarySearchRecurisve
* changes in test function
  - 3 binarySearchRecursive tests
  - 3 binarySearchIterative tests
2020-10-01 21:24:12 +05:30
a47923d210 Fixed exponentialSearch.js and interpolationSearch.js 2020-08-10 21:06:58 +03:00
6dbb849911 Added Interpolation and exponential searches in the javascript repo 2020-08-10 18:03:01 +03:00
ef5566f6a6 Update BinarySearch.js (#209)
* Update BinarySearch.js

The old algorithm didn't work, I believe for two main reasons:
1 -  Number.MAX_VALUE is not a valid array index as it is used to represent the highest possible value in javascript (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE);

2 - splice() is not a pure function, every time it is called it has the side effect of modifying the original array (https://www.w3schools.com/jsref/jsref_splice.asp) ;

So I rewrote the algorithm, it now returns an index ( -1 if not found ) and it works both on numbers and on strings.

* Update BinarySearch.js

Style change

* Update BinarySearch.js

Style change

* Update BinarySearch.js
2020-06-28 12:29:19 +05:30
7ff6b8716f editing file names 2020-05-06 21:07:49 +05:30
315be0e413 search/ (#143) 2020-05-04 18:57:53 +05:30
856dc2f63c npx standard --fix 2020-05-03 09:05:12 +02:00
f37cac8508 Fixed Whitespace, Operators, and Quotes to Comply with JSLint
I modified the whitespace in the files and changed single quotes to double quotes.

I also changed some `==` and `!=` operators to `===` and `!==` to comply with JSLint.
2019-06-27 10:41:44 -04:00
695ac54df2 Update jumpSearch.js 2019-05-11 10:13:32 +08:00
e92c4ae40a Added JumpSearch algorithm 2019-05-10 17:43:44 +09:00
9bccfacb0d Added Implementation of Binary Search 2017-08-17 16:02:59 +05:30
adbd6d7ca9 Update linearSearch.js 2017-08-17 11:10:10 +05:30
d88c04f5ee Added Implementation of Linear Search 2017-08-17 11:08:36 +05:30