javascript-algorithms README

The project's README from github.com/trekhleb/javascript-algorithms. As one markdown file: README.md.

JavaScript Algorithms and Data Structures

🇺🇦 UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED.


CI codecov repo size

This repository contains JavaScript based examples of many popular algorithms and data structures.

Each algorithm and data structure has its own separate README with related explanations and links for further reading (including ones to YouTube videos).

Read this in other languages: 简体中文, 繁體中文, 한국어, 日本語, Polski, Français, Español, Português, Русский, Türkçe, Italiano, Bahasa Indonesia, Українська, Arabic, Tiếng Việt, Deutsch, Uzbek, עברית

Data Structures

A data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

Remember that each data has its own trade-offs. And you need to pay attention more to why you're choosing a certain data structure than to how to implement it.

B - Beginner, A - Advanced

Algorithms

An algorithm is an unambiguous specification of how to solve a class of problems. It is a set of rules that precisely define a sequence of operations.

B - Beginner, A - Advanced

Algorithms by Topic

Algorithms by Paradigm

An algorithmic paradigm is a generic method or approach which underlies the design of a class of algorithms. It is an abstraction higher than the notion of an algorithm, just as an algorithm is an abstraction higher than a computer program.

How to use this repository

Install all dependencies

npm install

Run ESLint

You may want to run it to check code quality.

npm run lint

Run all tests

npm test

Run tests by name

npm test -- 'LinkedList'

Troubleshooting

If linting or testing is failing, try to delete the node_modules folder and re-install npm packages:

rm -rf ./node_modules
npm i

Also, make sure that you're using the correct Node version (>=16). If you're using nvm for Node version management you may run nvm use from the root fol

javascript-algorithms (trekhleb/javascript-algorithms)

Searching Database…

这是什么?这是一个大型集合,收录了经典算法和数据结构的 JavaScript 实现。每个算法都有自己的文件夹,内含代码、测试,以及一份 README,解释其理论并提供延伸阅读链接。
这是可以导入使用的库,还是学习资料?它主要是一份教育性参考资料,而不是可以安装的 npm 包。每个算法都放在自己的文件夹中,包含源代码、测试和讲解性的 README,供人阅读和学习,而不是作为依赖引入。
我该如何运行示例和测试?克隆仓库后,运行 npm install 安装依赖,然后用 npm run test 执行 Jest 测试套件,或用 npm run lint 通过 ESLint 检查代码质量;你也可以按名称单独运行某个测试。
我需要特定版本的 Node 吗?需要,至少是 Node 16 或更新版本(package.json 甚至指定了 Node >=22)。如果代码检查或测试失败,删除 node_modules 后重新安装,并用 nvm 再次确认你的 Node 版本。
这个项目是打算作为依赖用在实际项目中的吗?不是。它是为学习和面试准备而构建的,而不是生产级库;没有已发布的包,只有按算法划分的源文件,供阅读,必要时也可以复制使用。
内容是怎样组织的?算法既按主题分类(数学、字符串、排序、图、树、密码学等),也按算法范式单独分类(暴力法、贪心、分治、动态规划、回溯、分支限界)。
初学者应该从哪里开始?条目分为 B(入门)和 A(进阶)两类标记,例如链表、二分查找、冒泡排序、斐波那契数标为 B,因此初学者应先学习标有 B 的主题。
内容有英语以外的语言版本吗?有。README 已被翻译成多种语言,包括中文、韩语、日语、波兰语、法语、西班牙语、葡萄牙语、俄语、土耳其语、意大利语、印尼语、乌克兰语、阿拉伯语、越南语、德语、乌兹别克语和希伯来语。
它也涵盖机器学习吗?涵盖。它包括 k-NN 和 k-Means 聚类等基础机器学习算法,还有 'NanoNeuron',一个用来说明机器如何学习的微型前向传播和反向传播示例。
Creator
trekhleb
Size
14.6 MB
Stars
196.7K
Updated
CommitJul 26
Age
8y
Commits · 90 Days