69 Commits

Author SHA1 Message Date
c5101e3e2b chore: add reverse to singly linked list (#1241)
* Fix: Reverse Singly Linked List

* Added reverse in SinglyLinkedList

* Added reverse in SinglyLinkedList

* Changes made
2022-10-30 14:46:56 +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
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
cf0593f430 Refactor Cycledetection.js and added it's test. (#1099) 2022-09-15 12:22:44 +05:30
e7ee09a07d feat: AVLTree 100% test coverage (#1098) 2022-09-13 14:45:20 +05:30
6ad2467545 algorithm: find the middle of linked-list (#1096)
* Added Middle of linked-list implementation.

* Added Middle of LL function and tests

* Refactor: Added method in singly LL and its tests

* Refactor: Method name and inline test calls

* Use `!== null` instead of `!= null`

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-09-10 19:17:50 +05:30
a133529122 merge: Bugfix AVLTree comparator (#1084)
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.
2022-08-15 21:57:31 +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
e05b4432d8 merge: Improved the complexity of dequeue O(n) to O(1) (#1005)
* feat: improved memoize function

used Map instead of object & used the JSON.stringfy method for generate a valid string as a key

* docs: modified documentation

* style: format with standard

* docs: modified stringify doc

* refactor: remove two repetition implementation

* feat: added validation, test codes

* chore: remove useless words

* feat: added types for jest

* chore: added link box

* feat: added new validation test casses & methods

* style: formated with standard

* feat: added parse method & test cases

* docs: added js docs

* chore: added default import export

* feat: imporved algorithm via replace method

* test: added two test cases

* feat: added jest type for suggestions

* feat: added `reduceRight` & `trim` method

* chore: added helper variable

* feat: added new rotation option

* Revert "chore: added helper variable"

This reverts commit 489544da0a3d479910fbea020d3be3d0d10681bf.

* remove: yarn lock

* chore: fix grammer

* feat: used replace method & added test case

* feat: remove revert

* chore: added new line

* feat: updated the Queue array to linkedlist DS

* chore: fixed grammer

* resolve: removed capacity related codes, & updated test cases

* feat: added length dicrease code on dequeue
2022-05-06 21:50:55 +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
74857b7a9e merge: Improvement on singly circular linkedList (#981)
* Auto-update DIRECTORY.md

* Update and rename SingleCircularLinkedList.js.js to SinglyCircularLinkedList.js

* Test Case creation for SinglyCircularLinkedList

* Update SinglyCircularLinkedList.js

* Update SinglyCircularLinkedList.test.js

* Update SinglyCircularLinkedList.js

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-10 15:36:48 +05:30
dfe200a957 merge: Improving coding standard of singly linked list (#980)
* Auto-update DIRECTORY.md

* Changes on SinglyLinkedList

* Spelling change

* Added comment for initiateNodeAndIndex()

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-04-09 12:26:22 +05:30
233ec596dc merge: Add Graph3 (add DFS in Iterative Way) (#944)
* Add Graph3 (add DFS in Iterative Way)

* Remove example code and add test code (Graph3)

* Remove redundant code (like return undefined)
2022-03-24 12:42:26 +05:30
be15d08b4a merge: replaced constructor function with es6 class syntax (#900)
* replaced constructor function with es6 class syntax

* formatted code with standard.js
2022-02-23 16:16:45 +05:30
29a3ab73bc merge: Iterator and log methods added for linked lists (#891)
* iterator, log methods added in SL

* iterator, log methods added in DL

* test file added for DoublyLL

* format issue fix
2022-02-18 20:13:45 +05:30
9911410e70 merge: Implement Add Two Numbers (Linked List) (#888)
* Implement Add Two Numbers (Linked List)

* Implement Add Two Numbers (Linked List)

* Implement Add Two Numbers (Linked List)

Co-authored-by: Shakil Ahmmed <shakilahmmed@ShakilAhmmeds-MacBook-Pro.local>
2022-02-17 17:29:36 +05:30
c9701e8a4c merge: Improving the coding standard for AvLTree Data Structure (#882)
* Improving the coding standard for AvLTree Data Structure

* Test case creation for AVLTree

~ Created test cases for AVL Tree
~ Indentation fix for AVLTree.js

* Auto-update DIRECTORY.md

* Change in logic for data list

* Style fix based on standard.js

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-02-17 14:08:26 +05:30
c496925d25 merge: rename SinglyLinkList to SinglyLinkedList (#881) 2022-02-14 13:49:10 +05:30
961f21f97c merge: Add test case and enacements (#858) 2021-12-01 11:38:06 +05:30
c33b19a731 merge: Graph (#850)
* Modify Graph bfs method

* add dfs in graph
2021-11-27 11:08:35 +05:30
061218b693 merge: Modify Graph bfs method (#847) 2021-11-26 22:16:23 +05:30
4aac366694 merge: Refactor Code and Add test case (#845) 2021-11-25 10:18:26 +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
9ad93c7b28 merge: Create findRelativeMaximumPointCount.js (#771)
* Create find_relative_maximum_point_count.js

print number of relative maximum points in array
runs in O(n)

* rename file to match requested casing

* add inline comments and greater documentation

* fix wrong reference to algorithm explanation

* remove live code and fix function misnaming

* add multiple cases tests

* add last line as empty line

* git pull

* style changes

* move tests to test folder

* chore: fix spelling

* fix package-lock

* revert to old lock file

* chore: add line feed

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-10-28 12:15:01 +05:30
820f8e9c29 merge: Create firstRelativeMaxPointInArray.js (#772)
* Create first_relative_max_point_in_array.js

go over randomly generated array and print first spike or maximum point index in it
runs in O(log(n))

* rename file to match requested casing

* add comments

I prefer SOLID standards so that's why didn't add them at first but due to the repository requirements was needed to be added

* remove template unrelated comments

* Update equals check to match JavaScript standards

* create file skafolding and adjust filename to reflect main function

* using newer node version

* add tests

* add last line as empty line

* style changes

* move algorithm tests to test folder

* revert to old package lock file

* chore: add ending line feed

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-10-28 12:07:48 +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
e4808a6513 merge: Add MinHeap and test (#817)
* Add MinHeap and test

* Add description and reference link

* Adjust formatting
2021-10-27 23:19:52 +05:30
4fb0809666 merge: fixes: #774 - add test and fix MinPriorityQueue implementation (#811) 2021-10-26 09:11:32 +05:30
e83b570d44 merge: fixed some spellings (#773)
* fixed some spellings

* Update Data-Structures/Linked-List/SinglyLinkList.js

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-10-22 13:26:26 +05:30
22ce7603e4 fix: standard style issues 2021-10-21 22:59:56 +05:30
df4a783b06 Complying with JavaScript Standard Style (npx standard --fix). 2021-10-11 15:49:24 +02:00
036ac907ae Graph2.js : Convert live test into Jest test. 2021-10-11 14:23:24 +02:00
e18718b7d5 Remove live code & console.log, leave examples as comments. 2021-10-11 14:07:10 +02:00
449ef45193 Data Structure : Convert live test to Jest test. Remove live code & console.log 2021-10-10 16:25:41 +02:00
a3d44ad3e1 Data Structure : remove live code & console.log 2021-10-10 16:11:06 +02:00
cbe7e0c89f Comply with ESM syntax. 2021-10-09 13:18:40 +02:00
95b75e81d3 chore: merge Fix/742 migrate doctest for Vector2.js (#752)
* Migrate doctest for Vector2.js

* Remove eslint disabling for no-unused-vars since now the class is exported at the end of the file

* Group all related tests to own jest describe blocks

* Improve the doc-comment by fixing it's formatting
2021-10-07 12:39:06 +05:30
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
e27bc0a702 resolved conflicts 2021-10-05 14:05:11 +05:30
1c22f65ce7 fixed the issue in Trie file and typo in sudoku 2021-10-05 12:53:38 +05:30
1589263947 fixed some spellings 2021-10-05 12:49:23 +05:30
f071220c3e chore: merged "Quick select tests" (#697)
* add link to function description

* fix formatting for consistency

* export function so it can be imported for testing

* throw error on invalid input

* add tests for QuickSelect.js

* remove unnecessary comment

* Update Data-Structures/Array/QuickSelect.js

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>

Co-authored-by: Rak Laptudirm <raklaptudirm@gmail.com>
2021-09-27 21:44:11 +05:30
8c7d592191 chore: merge "removeValue method implemented to remove a particular node from the BST #687" (#696)
* removeValue method of BST implemented #687

* code has formatted for the file BinarySearchTree.js
2021-09-27 11:02:10 +05:30
00d110fc98 Add doctest on quickselect algorithm 2021-06-09 17:15:58 +06:00
e0eb0631f4 Merge pull request #371 from Sandeepan-Das/add-CircularQueue
Add Circular Queue
2021-05-23 12:58:38 +05:30
ca4c1a62af style: Fixed most styles (according to standardjs) 2021-05-21 11:16:11 +05:30
625296b5bc Add Vector2 (#593)
* add Vector2.js
* Rename Data-Structures/Vector2.js to Data-Structures/Vectors/Vector2.js
2021-04-30 01:27:11 +12:00
4df41124f8 Merge pull request #536 from Lakhan-Nad/AVLTree
AVL Tree Added in JS Fixes:#535
2021-01-17 09:38:48 +05:30
e62844f7d2 Update Queue.js 2020-10-31 12:03:11 +05:30