Skip to content

Algorithms and Data Structures implemented in modern JS

License

Notifications You must be signed in to change notification settings

vanillaes/computer-science

Repository files navigation

Computer Science

A collection of Computer Science algorithms and data structures implemented using bleeding-edge JavaScript features and capabilities

GitHub Release NPM Release Latest Status Release Status

Discord

Algorithms and data structures are essential foundations if you ever want to advance in the professional development world. The goal of this library is to provide a modern Javascript specific reference to study and experiment with a wide range of general purpose algorithms and data structures. This is by-no-means the first JS lib of its kind but it is the first that is 100% dedicated to using modern JS practices and patterns.

Modern Javascript

ECMAScript standards have come a long way in the past 5 years (ie ES2015 - ES2020) but it will take a lot of time for the rest of the greater JS ecosystem to catch up. This library is a 'clean room' implementation, written from scratch to use modern practices by default.

For Example:

  • all modules ES modules
  • index.js define the public API
  • no build-tooling required
  • classes are used liberally
  • [Symbol.iterator] definitions for data structures
  • cross-browser compatibility is a low priority
  • in Node.js this package loads as type=module

That means...

Not only does this package provide a useful reference for Computer Science principles but it also works as a reference for Modern JS best-practices.

Imports

This package works isomorphically in browsers and server-side JavaScript runtimes

Browsers

Import directly from the local path or a CDN

<script type="module">
import { LinkedList } from 'path/to/computer-science/index.js'
</script>

The minified version can be imported from

<script type="module">
import { LinkedList } from 'path/to/computer-science/index.min.js'
</script>

Node

Install the package

npm install @vanillaes/absurdum

Import from the installed module

import { LinkedList } from '@vanillaes/computer-science';

API Documentation

Data Structures

Disjoint-Set

Disjoint sets are used to determine the connectivity within a graph by grouping vertices into unique sets.

Linear

Linear data structures get their name because they are typically used to map 1-to-1 relationships between data elements in a one-dimensional fashion.

Set

A set represents a collection of unique values.

Misc

Algorithms

Related Materials