轻量级的 JavaScript 数据结构与算法库。

Overview

💖 js-algorithm-light 💖

定位 💺

轻量级的 JavaScript 数据结构与算法库。

为什么? 🙋

众所周知, JS 内置数据结构与算法的支持情况简直惨淡。大家如果真的要使用一些“高级”数据结构,要不自己实现,要么使用一些优秀的开源框架。这本身没有问题。但是:

  • 如果面试用到了某一个数据结构,恰好 JS 不内置怎么办?
  • 我想知道某一个数据结构(比如堆)的实现原理怎么办?

一般而言,我们有两种方法:

  1. 看优秀 JS 数据结构框架的源码。
  2. 看网上大家实现的代码。

先说第一种方式。框架源码为了兼容一些 edge case 或者提升压榨一点性能往往采取一些 hack,这些 hack 会极大阻碍你的阅读效率。因此这种方式我并不推荐。

再说下第二种方式。我在开辟仓库之前也搜索过一些数据结构的 JS 实现,给我的感觉就是 不优雅,不简洁。另外网上也不存在一个系统性的资料,大家的代码风格也各不相同,这对学习效率而言是不利的。

因此我开辟了这个仓库,暂定的目标是对标 Python 所有的内置数据结构和算法

RoadMap 📘

目前实现了 heap, deque 和 binary_search 的主要 api。

heap deque binary_search sorted_list indexed_priority_queue
pop popleft bisect_left pop
push append bisect_right push
heapify change

点击表格中的链接可以直接定位到源码文件。

Try it online

You might also like...

A Powerful and Elegant "alert" library for JavaScript that replaces that boring alert style of Javascript.

A Powerful and Elegant

A Powerful , Elegant and fully customizable "alert" library using JavaScript that replaces that boring style of alert. Installation Place the below sc

Aug 10, 2021

Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript.

Device.js Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript. Compatibility Works with all m

Dec 16, 2022

It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm and toast with the library.

asteroid-alert It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm with the library. It has also e

Mar 12, 2021

A little JavaScript plugin to generate PDF, XLS, CSV and DOC from JavaScript Object or DOM element only from the frontend!

💫 JavaScript Object to csv, xls, pdf, doc and DOM to html generator 💫 A little JavaScript plugin to generate PDF, XLS, CSV and DOC from JavaScript O

Jan 7, 2023

Leader Board is a simple project based on JavaScript programing language. The purpose of this project is to work with APIs and ASYNC & AWAIT methods. I have used vanilla JavaScript with web pack to implement this project

Leader Board is a simple project based on JavaScript programing language. The purpose of this project is to work with APIs and ASYNC & AWAIT methods. I have used vanilla JavaScript with web pack to implement this project

Leader Board - JavaScript Project Table of contents Overview The challenge Screenshot Links Project Setup commands My process Built with What I learne

Oct 21, 2022

This repo has demos, content and documentation of javascript concepts and syntax, in their simplest form. Contribute by sharing your understanding of javascript! Hacktoberfest Accepted!

javascript-documentation open-source hacktoberfest2022 Submit your PR to this javascript-documentation repo 🧭 🌟 ❗ This repo has some of my javascrip

Nov 2, 2022

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

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

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

Dec 29, 2022

A book series on JavaScript. @YDKJS on twitter.

A book series on JavaScript. @YDKJS on twitter.

You Don't Know JS Yet (book series) - 2nd Edition This is a series of books diving deep into the core mechanisms of the JavaScript language. This is t

Dec 29, 2022

JavaScript Style Guide

Airbnb JavaScript Style Guide() { A mostly reasonable approach to JavaScript Note: this guide assumes you are using Babel, and requires that you use b

Jan 4, 2023
Owner
lucifer
deep thinking make you wise
lucifer
Reference for How to Write an Open Source JavaScript Library - https://egghead.io/series/how-to-write-an-open-source-javascript-library

Reference for How to Write an Open Source JavaScript Library The purpose of this document is to serve as a reference for: How to Write an Open Source

Sarbbottam Bandyopadhyay 175 Dec 24, 2022
Open Source projects are a project to improve your JavaScript knowledge with JavaScript documentation, design patterns, books, playlists.

It is a project I am trying to list the repos that have received thousands of stars on Github and deemed useful by the JavaScript community. It's a gi

Cihat Salik 22 Aug 14, 2022
Javascript-testing-practical-approach-2021-course-v3 - Javascript Testing, a Practical Approach (v3)

Javascript Testing, a Practical Approach Description This is the reference repository with all the contents and the examples of the "Javascript Testin

Stefano Magni 2 Nov 14, 2022
Navigation-Menu-Javascript - A simple Navbar navigation using vanilla javascript, to change links to the active link when clicked.

Navigation-Menu-Javascript A simple Navbar navigation using vanilla javascript, to change links to the active link when clicked. Desktop view Mobile v

Ellis 2 Feb 16, 2021
Ping.js is a small and simple Javascript library for the browser to "ping" response times to web servers in Javascript

Ping.js Ping.js is a small and simple Javascript library for the browser to "ping" response times to web servers in Javascript! This is useful for whe

Alfred Gutierrez 353 Dec 27, 2022
MenuSlider-Javascript - How to create a menu slider with vanilla javascript

MenuSlider-Javascript How to create a menu slider with vanilla javascript Instal

Tarokh Mohammadi 1 Feb 8, 2022
Simple Library implemented using HTML, CSS and JavaScript. This is a simple implementation of JavaScript Modules of ES6.

Awesome-books A single page project with the porpuse of storing books' titles and authors. Built With CSS, HTML & Javascript. How to run in your local

Saadat Ali 7 Feb 21, 2022
This is a project that allows users to add/remove books from a list. we accomplish this by using a JavaScript object. Built with JavaScript, Html and CSS.

Awesome-book This is a project that allows users to add/remove book from a list. we accomplish this by usig javascript oject. Built With HTML5 CSS3 Ja

Juan Fco. Rosario Suli 6 May 27, 2022
JavaScript project for the Leaderboard list app, using Webpack and ES6 features, notably modules. this app consume the Leaderboard API using JavaScript async and await and add some styling.

Leaderboard Project JavaScript project for the Leaderboard list app, using Webpack and ES6 features, notably modules. this app consume the Leaderboard

bizimungu pascal 4 May 20, 2022
Custom alert box using javaScript and css. This plugin will provide the functionality to customize the default JavaScript alert box.

customAlertBoxPlugin Custom Alert Box Plugin Using JavaScript and CSS Author: Suraj Aswal Must Include CSS Code/Default Custom Alert Box Class: /* mus

Suraj Aswal 17 Sep 10, 2022