Git Product home page Git Product logo

thealgorithms / javascript Goto Github PK

View Code? Open in Web Editor NEW
31.3K 612.0 5.4K 2.89 MB

Algorithms and Data Structures implemented in JavaScript for beginners, following best practices.

Home Page: https://the-algorithms.com/language/javascript

License: GNU General Public License v3.0

JavaScript 99.97% Shell 0.01% TypeScript 0.02%
algorithm algorithm-challenges data-structures cryptography cipher search sort sorting-algorithms mathematics conversions

javascript's Introduction

The Algorithms Official Website


This is a static Next.js site providing a searchable library of all the algorithms in The Algorithms. All the data about the algorithms gets scraped directly from the git repositories.

Translating the website

You can help us translate the TheAlgorithms website using Weblate here. There you can complete the translations for our current languages, or suggest something if you are unsure. Also feel free to add a new language. The current languages are:

Translation status by language

Getting Started

If you haven't installed it yet, install Node.js and yarn. Then, install all the dependencies:

yarn

After that, run the script that fetches all the algorithms from GitHub:

yarn fetch-algorithms

Finally, run the development server:

yarn dev

Open http://localhost:3000 with your browser to see the website.

Alternatively, you can also use the Ready-to-Code Gitpod and easily check how your deployment looks. It will automatically run the commands mentioned above on run.

Contributing

If you want to add a new feature or fix a bug, create a new branch or fork and commit there. Before opening a PR, be sure to

  • Run yarn lint and fix potential errors
  • Run yarn build to check if everything still builds successfully

Open the pull request against main. Vercel will automatically create a preview deployment, and the pull request will be squash merged after being reviewed by a member.

License

The source code of website itself (this repository) is licensed under MIT, while all the licenses for the code and explanations on the website can be found in the respective repositories.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Powered by Vercel

javascript's People

Contributors

abhinavxt avatar algobytewise avatar ankush263 avatar anupkumarpanwar avatar appgurueu avatar cclauss avatar charliejmoore avatar chiranjeev-thapliyal avatar christianbender avatar defaude avatar dependabot[bot] avatar fahimfaisaal avatar itsvinayak avatar josecarlosweb avatar leeyan44 avatar lvlte avatar mandy8055 avatar marsonya avatar masa-shin avatar ms10398 avatar pomkarnath98 avatar rahul1995 avatar raklaptudirm avatar rodigu avatar ruppysuppy avatar suryapratapsinghsuryavanshi avatar vil02 avatar waddah-jd avatar winsonrich avatar yatin-kathuria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript's Issues

Typescript version?

These algorithm implementations are very helpful. But they could be shorter and easier to understand with Typescript, using Typescript features. Many people use Typescript instead of directly Javascript now. How about converting these algorithms to Typescript?

Build DIRECTORY.md with JavaScript, not Python

We present all of of our algorithms in an organized list, DIRECTORY.md so visitors can rapidly find topics of interest. Currently DIRECTORY.md is being autogenerated by one of our GitHub Actions which uses Python code to create the directory text.

Why should the JavaScript repo rely on Python code?!? Especially given that GitHub Actions fully support the creation of JavaScript-based Actions. Can we use JavaScript to autogenerate DIRECTORY.md and lose the Python code in the process?

suggestion - allow attaching label in PR

This is suggestion to add labels such as

  • In Progress
  • Ready for Review
  • On Hold
  • Need Help
    etc...

Thanks again & once again kudos for this amazing initiative & library...

Algorithm needed for graphs data structures

some algorithms ๐Ÿฅ‡

  • Add Kruskal's Algorithm to find Minimum Spanning Tree
  • Algorithm to find the Minimum Spanning Tree using Prims Algorithm #227
  • Algorithm to find connected components using Disjoint sets
  • Algorithm to find connected components in the graph using depth-first search #223
  • Depth First Search Algorithms #199

feel free to add more algorithms in the list
thank you, @itsvinayak

Split READMEs for each folder.

instead of keeping one solitary readme I the root folder, it would be better to add separate README to each folder.
what this would achieve would be that for someone interested in ciphers should open the folder and find details in the README specific to ciphers only.
This seems like an easy process of splitting the README into separate duplicates and then adding them to individual folders, I would really love it if I can work on this. ๐Ÿฅ‡ ๐Ÿ˜ƒ

JavaScript

For extra learning reference material

An improvement on Ficbonacci function using DP

// My code just improves a little
// Feel free to ask me questions

function dp_ficbo(n)
{
var val = [];
for ( let i = 0; i <= n; i++)
{
val[i] = 0;
}

	if ( n == 1 || n == 2)
	{
		return 1;
	}
	else
	{
		val[1] = 1;
		val[2] = 2;

		for ( let i = 3; i <= n; i++ )
		{
			val[i] = val[i - 1] + val[i - 2];
		}
	}

	return val[n - 1];
}

console.log(dp_ficbo(20));

TimingFunction/IntervalTimer with NodeJS

The function works fine on the browser. The instance returns the time run.
However, nodeJS uses a completely different structure for it's timers.
It may not be necessary in NodeJS. I genuinely think it helps otherwise, I use it to time my unit tests.

The value returned by setInterval() is the total runtime of the timer.

more contributors are needed

  • Adding hints and doctest to old codes
  • Reviewing Pending PRs ( fixing code format by running npm standard --fix PR labeled under "failing npm standards" )
  • Helping new Contributors
  • Add more algorithms

thank you

Addition of .gitignore file

Add .gitignore file to ignore the addition of node modules and other unwanted files in the commits.

If a memeber views this, please add good first issue and difficulty: easy labels

Files that are not compliant with standardjs

The following FilePaths fail npx standard FilePath and can not be fixed using the --fix option.


  • Javascript/Ciphers/keyFinder.js #140
  • Javascript/Ciphers/vigenereCipher.js #140
  • Javascript/Conversions/DecimalToHex.js #140
  • Javascript/Data Structures/Graph/Graph.js #141
  • Javascript/Data Structures/Heap/MinPriorityQueue.js #140
  • Javascript/Data Structures/Linked List/DoublyLinkedList.js #140
  • Javascript/Data Structures/Queue/Queue.js #140
  • Javascript/Data Structures/Stack/Stack.js #140
  • Javascript/Data Structures/Tree/Binary Search Tree.js #140
  • Javascript/Hashes/SHA256.js
  • Javascript/Search/linearSearch.js #143
  • Javascript/Sorts/TopologicalSort.js #141
  • Javascript/Sorts/bogoSort.js #150
  • Javascript/Sorts/bucketSort.js #141
  • Javascript/Sorts/combSort.js #141
  • Javascript/Sorts/cycleSort.js #141
  • Javascript/Sorts/heapSort.js #150
  • Javascript/Sorts/selectionSort.js #141
  • Javascript/Sorts/wiggleSort.js #150
  • Javascript/maths/DijkstraSmallestPath.js #147
  • Javascript/maths/abs.js #144
  • Javascript/maths/factorial.js #145
  • Javascript/maths/find_lcm.js #146
  • Javascript/maths/graph.js

Feature: Adding Introsort implementation in JS.

We can add the sort routine used by std::sort in c++ standard library in JavaScript.
Introsort is a hybrid sorting algorithm that uses quicksort and heapsort. The C++ STL takes it a step further and adds insertion sort to it for small length arrays.
We can add a method is JS for introsort which takes array and a compare function as parameters and sorts the array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.