259 Commits

Author SHA1 Message Date
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
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
d1152144aa algorithm: Liouville function (#1100) 2022-09-15 12:20:58 +05:30
644d7f7faa Binomial coefficient implementation (#1094) 2022-09-08 10:14:33 +05:30
61c9e8b372 fix: factorial function (#1093) 2022-09-07 15:00:35 +05:30
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
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
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
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
cc16cbdf84 Added JugglerSequence.js (#1075) 2022-08-03 22:32:34 +05:30
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
1b64ba68fa Fibonacci.js overhaul (#1049) 2022-06-27 10:09:54 +05:30
95a8ec08ed merge: More accurate error message at IsDivisible (#1048)
* More accurate error message

* Lowercased "R"
2022-06-21 22:47:45 +05:30
92a81a2290 merge: Add Twin Primes algorithm (#1024)
* Create TwinPrime.js

* Update TwinPrime.js

* Create TwinPrime.test.js

* Update TwinPrime.js

* Update TwinPrime.js

* Add suggestions

* Update TwinPrime.test.js

* Update TwinPrime.js

* Styling
2022-05-27 21:28:45 +05:30
0357a23282 merge: Add the Collatz Conjecture (#1022)
* Create CollatzConjecture.js

* Create CollatzConjecture.test.js

* Update CollatzConjecture.js

* Update CollatzConjecture.test.js

* Rename CollatzConjecture.js to CollatzSequence.js

* Update and rename CollatzConjecture.test.js to CollatzSequence.test.js

* Update CollatzSequence.js

* Update CollatzSequence.test.js

* Update CollatzSequence.test.js

* Fix styling errors

* Add suggestion

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>

* Update CollatzSequence.js

* Update CollatzSequence.js

* Update comments to match the Collatz Sequence

* Update CollatzSequence.test.js

Co-authored-by: Rak Laptudirm <rak@laptudirm.com>
2022-05-26 08:37:53 +05:30
dc67506272 merge: Add pronic number implementation (#1023)
* feat: Add pronic number implementation

* Add test to Math

* Minor fixes

* Minor style fixes

* refactor: Store square root in a variable

* Minor refactoring

* fix: Change pronic number check logic

Reduced time complexity from O(sqrt(n)) to O(1)

* Minor style fixes

* fix: Update pronic number check boolean equation

* refactor: Change pronic number check condition

* refactor: Add tests to Math

* Minor style fixes

* refactor: Change unit test logic
2022-05-25 17:39:23 +05:30
21a851176d merge: Find max recursion (#1010)
* add yt video association algorithm

* Implement FindMaxRecursion in JS

* Delete file in other PR

* Fix requested changes

* Add requested changes

* Delete YoutubeVideoAssociation.test.js

* Deduplicate comment

* Remove trailing spaces

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-05-09 15:05:16 +05:30
5641b6faea Add Zeller's Congruence Algorithm in Math (#996) 2022-04-27 14:49:12 +02:00
c81db629b8 merge: EuclidGCD: add tests (#994)
test was not present beforehand.
2022-04-22 16:21:22 +05:30
9513bcd77a merge: WhileLoopFactorial: Optimize and add tests (#992)
* Optimised the factorial function.

There was previously an unnecessary check for if the number was 0 or 1.

* Create WhileLoopFactorial.test.js

The test was not present previously.

* result *= num

* Update WhileLoopFactorial.test.js

* testFactorial function

* Space for formatting.

* should fix the formatting issues. I was having trouble with npx standard, so I just used the online verifier at https://standardjs.com/demo.html
2022-04-21 21:58:29 +05:30
eb36e2de62 merge: Format codebase with standard.js (#989)
* Auto-update DIRECTORY.md

* fix: some redundancy according to standard javascript library

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-21 11:38:38 +05:30
8fc53906e6 merge: FindLCM: Improve code readablility (#985)
* fix: improving code readability

* fix: exchange break to return lcm

* fix: fixing condition for improve readability
2022-04-20 21:29:29 +05:30
2be0fdcb49 merge: Decimal Expansion (#787)
* Add Math function for representing the decimal expansion of a given fraction (decimal or any base from 2 to 10).

* Auto-update DIRECTORY.md

* DecimalExpansion Jest tests.

* chore: trigger update

* Auto-update DIRECTORY.md

* Auto-update DIRECTORY.md

* chore: trigger checks

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Rak Laptudirm <rak@laptudirm.com>
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2022-04-02 20:40:57 +05:30
b85bf49a35 merge: Fixed a wrong sentence structure (#952)
* Fixed a typo where the commenting was wrong

* optimised code

* fixed a sentence structure

* changed the sentence structure

* updated pull request

* Update SetBit.js
2022-03-27 22:43:21 +05:30
ffa4846994 merge: Add FindMinIterator algorithm (#928)
* FindMinIterator

Do the `standard` thing.

Rename `FindMin` to `FindMinIterator`

Rename to `FindMinIterator`

Pull `FindMin` from `master`

* Remove these separator comments.

Co-authored-by: RuSaG0 <mirzoev-ruslan-2000@mail.ru>
2022-03-16 17:31:25 +05:30
a545f76669 merge: Add test case of SquareRoot function (#926) 2022-03-15 20:39:34 +05:30
0924f1c8c9 merge: Improved abs function (#923)
* feat: added validation, test codes

* chore: remove useless words
2022-03-15 17:41:50 +05:30
da6c22704e merge: refactor isEven function (#920)
* refactor: formated docs and functions

* refactor: format all test codes
2022-03-11 22:16:02 +05:30
4f6fe1975c merge: resolve example mistake (#919) 2022-03-10 22:25:06 +05:30
98c46b4d9e merge: Improved IsOdd function (#914)
* refactor: used Boolean function for conversion

* feat: added one more function and test cases

* test: refactor test case & fixed var names

* chore: fixed test placeholder
2022-03-04 16:34:33 +05:30
ab06131656 merge: Improved Pow function (#911)
* feat: add negative power option

* docs: add js doc for powOn function

* feat: add PowFaster with faster algorithm, complexity O(logN)

* chore: rename to exponent

* chore: rename fixed

* style: formated with standard
2022-03-02 09:06:40 +05:30
0178efd8df merge: Algorithm to calculate the Arithmetic Geometric Mean (#897)
* Create ArithmeticGeometricMean.js

* Finally added the test script for AGM

* Better doc, and corrected some formatting

* Fixed syntax typos

* Added more tests and made FP comparison more "loose"

* Patched bugs

* Fixed-0 bug

* Again, tried to fix minus zero

* Finally fixed all bugs (probably)

* Fixed style (probably)

* Fixed style

* Fixed all style
2022-02-24 16:15:56 +05:30
743b3179f7 merge: Corrected JSdoc typo (#898)
The URL in the Wikipedia link had an extra "h" in the URI Scheme (the part that specifies the protocol, usually `https`). I removed the duplicate "h" and made it into a single "h", now the link works
2022-02-21 16:28:40 +05:30
49fa7d1a9b merge: improve median (#869)
* median

* [/pull/869] make fn pure

* [/pull/869/] pure averageMedian fn

* [/pull/869] formatter
2021-12-20 22:27:05 +05:30
ef832f6920 merge: add areaTriangleWithAllThreeSides method in Math/Area.js (#875) 2021-12-15 23:00:11 +05:30
3d2a48f798 merge: Improve Mean method (#874) 2021-12-15 22:58:28 +05:30
bbdb5cf38a merge: Binary Convert (#865)
* Binary Convert

* Update link

* add more test cases
2021-12-14 11:01:52 +05:30
f387ff327c chore: Remove duplicate DigitSum algorithm (#873)
* Auto-update DIRECTORY.md

* chore: remove duplicate algorithm

* Auto-update DIRECTORY.md

* chore: remove duplicate algorithm tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-12-11 13:40:11 +05:30
4d55b40c9e merge: Absolute value (#866) 2021-12-11 13:29:19 +05:30
de2708990d merge: Add FindMin (#849) 2021-11-26 22:12:30 +05:30
c1c895bebd chore: Add PowLogarithmic in Math (#836)
* Add PowLogarithmic in Math

* add description
2021-11-19 10:40:51 +05:30
2619ab673f merge: Added bisection method (#827)
* feat: Added bisection method

* Auto-update DIRECTORY.md

Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-31 22:30:46 +05:30
7c39839714 merge: Add LinearSieve.js (#828) 2021-10-31 22:28:45 +05:30
09eebc492a merge: fix: optimize PrimeFactors (#823) 2021-10-29 09:57:16 +05:30
1cd3b8683a merge: Created midpoint integration numerical method (#822)
* Created midpoint integration numerical method

* Auto-update DIRECTORY.md

* Added resources link

* Fixed doxumentation

* Fixed spelling error

Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-28 18:09:40 +05:30
072523d594 merge: Fix spellings (#821)
* chore: remove codespell from ci

* feat: add codespell workflow

* fix: codespell workflow

* fix: ignore spellings in directory

* chore: fix spellings

./Dynamic-Programming/KadaneAlgo.js:2: contiguos ==> contiguous
./Dynamic-Programming/KadaneAlgo.js:14: posible ==> possible

* chore: fix spelling

./Dynamic-Programming/SieveOfEratosthenes.js:4: upto ==> up to

* chore: fix spellings

./Dynamic-Programming/MaxNonAdjacentSum.js:22: Exmaple ==> Example

* chore: fix spelling

./Project-Euler/test/Problem010.test.js:4: upto ==> up to
./Project-Euler/test/Problem010.test.js:8: upto ==> up to
./Project-Euler/test/Problem010.test.js:12: upto ==> up to

* chore: fix spelling

./String/AlphaNumericPalindrome.js:10: recieves ==> receives
./String/AlphaNumericPalindrome.js:10: sting ==> string
./String/AlphaNumericPalindrome.js:46: varaible ==> variable

* chore: fix spelling

./String/DiceCoefficient.js:3: stings ==> strings

* chore: fix spelling

./String/test/DiceCoefficient.test.js:9: atleast ==> at least

* chore: fix spelling

./String/test/MaxWord.test.js:8: ba ==> be

* chore: ignore `PermutateString.test.js`

* chore: fix spelling

./String/test/CheckVowels.test.js:62: occurances ==> occurrences

* chore: ignore `SubsequenceRecursive.js`

* chore: fix spelling

./Conversions/TemperatureConversion.js:2: arguement ==> argument

* chore: fix spelling

./Conversions/RailwayTimeConversion.js:7: Formate ==> Format
./Conversions/RailwayTimeConversion.js:8: Formate ==> Format

* chore: remove Linear Algebra

The deleted directory hosted a package which are not accepted by this repository.

* Auto-update DIRECTORY.md

* chore: fix spelling

* chore: fix spellings

* merge: Created composite Simpson's integration method. Tests included. (#819)

* Created composite Simpson's integration method.Tests included

* Minor corrections

* Auto-update DIRECTORY.md

* Styled with standard.js

* chore: remove blank line

* chore: remove blank line

Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: remove codespell from ci

* feat: add codespell workflow

* fix: codespell workflow

* fix: ignore spellings in directory

* chore: fix spellings

./Dynamic-Programming/KadaneAlgo.js:2: contiguos ==> contiguous
./Dynamic-Programming/KadaneAlgo.js:14: posible ==> possible

* chore: fix spelling

./Dynamic-Programming/SieveOfEratosthenes.js:4: upto ==> up to

* chore: fix spellings

./Dynamic-Programming/MaxNonAdjacentSum.js:22: Exmaple ==> Example

* chore: fix spelling

./Project-Euler/test/Problem010.test.js:4: upto ==> up to
./Project-Euler/test/Problem010.test.js:8: upto ==> up to
./Project-Euler/test/Problem010.test.js:12: upto ==> up to

* chore: fix spelling

./String/AlphaNumericPalindrome.js:10: recieves ==> receives
./String/AlphaNumericPalindrome.js:10: sting ==> string
./String/AlphaNumericPalindrome.js:46: varaible ==> variable

* chore: fix spelling

./String/DiceCoefficient.js:3: stings ==> strings

* chore: fix spelling

./String/test/DiceCoefficient.test.js:9: atleast ==> at least

* chore: fix spelling

./String/test/MaxWord.test.js:8: ba ==> be

* chore: ignore `PermutateString.test.js`

* chore: fix spelling

./String/test/CheckVowels.test.js:62: occurances ==> occurrences

* chore: ignore `SubsequenceRecursive.js`

* chore: fix spelling

./Conversions/TemperatureConversion.js:2: arguement ==> argument

* chore: fix spelling

./Conversions/RailwayTimeConversion.js:7: Formate ==> Format
./Conversions/RailwayTimeConversion.js:8: Formate ==> Format

* chore: remove Linear Algebra

The deleted directory hosted a package which are not accepted by this repository.

* Auto-update DIRECTORY.md

* chore: fix spelling

* chore: fix spellings

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: fix spelling

* chore: no need to check filenames

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: ggkogkou <76820848+ggkogkou@users.noreply.github.com>
Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
2021-10-28 15:37:43 +05:30
7722870183 merge: Created composite Simpson's integration method. Tests included. (#819)
* Created composite Simpson's integration method.Tests included

* Minor corrections

* Auto-update DIRECTORY.md

* Styled with standard.js

* chore: remove blank line

* chore: remove blank line

Co-authored-by: ggkogkou <ggkogkou@ggkogkou.gr>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-10-28 15:07:07 +05:30
7c2f19b691 merge: Rename 2 filenames to follow PascalCase (#816)
* Added LucasSeries

* Added more tests and renamed function

* Changed RangeError to TypeError

* Added Aliquot Sum and tests

* Fix ALiquot tests, need to learn how to use Jest

* Added some explanation for the Aliquot sum

* Change file names of DecimalIsolate & IsOdd to Pascal case
2021-10-26 16:56:45 +05:30
502aec24cb merge: Added Aliquot Sum Implementation (#810)
* Added LucasSeries

* Added more tests and renamed function

* Changed RangeError to TypeError

* Added Aliquot Sum and tests

* Fix ALiquot tests, need to learn how to use Jest

* Added some explanation for the Aliquot sum
2021-10-26 15:00:07 +05:30
69a397cc33 merge: Added LucasSeries Implementation (#808)
* Added LucasSeries

* Added more tests and renamed function

* Changed RangeError to TypeError
2021-10-25 10:03:02 +05:30