javascript-algorithms icon indicating copy to clipboard operation
javascript-algorithms copied to clipboard

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

Results 281 javascript-algorithms issues
Sort by recently updated
recently updated
newest added

I implemented the Tim Sort. I tried to keep it in the same fashion as other sorting algorithms as much as possible. I even used the source code of insertion...

I've added a matrix exponentiation function that computes A^n in O(n^3 * log(n)) in the Matrix.js file.

Hi, can I add a Malay version for README?

Non-recursive factorial function for BigInt data type.

Wrong array representation in Heap README.md

[{"_id":"62e716fe3f02dc4dab2ad1e2","body":"I would like to work on this issue. ","issue_id":1659297582755,"origin_id":778739531,"user_origin_id":17690376,"create_time":1613287343,"update_time":1613287343,"id":1659311870378,"updated_at":"2022-07-31T23:57:50.378000Z","created_at":"2022-07-31T23:57:50.378000Z"},{"_id":"62e716fe3f02dc4dab2ad1e4","body":"It is updated.","issue_id":1659297582755,"origin_id":914249338,"user_origin_id":48879218,"create_time":1631016522,"update_time":1631016522,"id":1659311870381,"updated_at":"2022-07-31T23:57:50.381000Z","created_at":"2022-07-31T23:57:50.381000Z"},{"_id":"62e716fe3f02dc4dab2ad1e7","body":"Is this issue still open?","issue_id":1659297582755,"origin_id":987931797,"user_origin_id":73112080,"create_time":1638884121,"update_time":1638884121,"id":1659311870385,"updated_at":"2022-07-31T23:57:50.384000Z","created_at":"2022-07-31T23:57:50.384000Z"},{"_id":"62e716fe3f02dc4dab2ad1e9","body":"this was fixed already at Wikipedia.","issue_id":1659297582755,"origin_id":991418143,"user_origin_id":13461315,"create_time":1639190767,"update_time":1639190767,"id":1659311870387,"updated_at":"2022-07-31T23:57:50.387000Z","created_at":"2022-07-31T23:57:50.387000Z"}] comment

![image](https://user-images.githubusercontent.com/17434488/107847159-60933600-6de9-11eb-97db-7abca0a9793a.png) in the array the node with value 3 has two children (2, 7), the correct parent of (2,7) should be 17 instead

Tail Call Optimized factorial function for BigInt data type.

Add factorialRecursiveTCO (Tail Call Optimized)

[{"_id":"62e717379a236c6edc5dfc52","body":"This is interesting, I wonder how you test this, since its dependent on the JS engine?\r\n\r\nE.g. Chrome doesn't seem to support this: https:\/\/chromestatus.com\/feature\/5516876633341952\r\n\r\nDebugger with stack trace:\r\n\r\n![image](https:\/\/user-images.githubusercontent.com\/5236548\/145709227-9f0854ac-40ac-42ac-8b15-642bdc83c2aa.png)\r\n\r\nWith the code: \r\n```js\r\nfunction factorialRecursiveTCO(number) {\r\n function fact(number, accumulator = 1) {\r\n console.log(\"fact\", number);\r\n debugger;\r\n if (number < 2)\r\n return accumulator;\r\n else\r\n return fact(number - 1, accumulator * number);\r\n }\r\n console.log(\"factorialRecursiveTCO\", number);\r\n return fact(number);\r\n}\r\nfactorialRecursiveTCO(10)\r\n```","issue_id":1659297582760,"origin_id":991874300,"user_origin_id":5236548,"create_time":1639305806,"update_time":1639305806,"id":1659311927829,"updated_at":"2022-07-31T23:58:47.829000Z","created_at":"2022-07-31T23:58:47.829000Z"}] comment

Create extractBits.js

[{"_id":"62e717389a236c6edc5dfc54","body":"@UjjwalAryal thank you for PR! Could you please provide tests and description in related README file?","issue_id":1659297582767,"origin_id":416233733,"user_origin_id":3000285,"create_time":1535377938,"update_time":1535377938,"id":1659311928403,"updated_at":"2022-07-31T23:58:48.403000Z","created_at":"2022-07-31T23:58:48.403000Z"}] comment

Function to extract 'k' bits from position 'p' and returns the extracted value as integer.