Giter Club home page Giter Club logo

jollections's Introduction

Jollections

The missing standard template library for JavaScript. The package contains common data structures and algorithms. To install the package, run npm install --save jollections or yarn add jollections --dev.

If you want to import it into your HTML via script tag then you can use unpkg link like below:

<script src="https://unpkg.com/[email protected]/dist/bundle.umd.js"></script>

Usage

With ES6 modules:

import { SinglyLinkedList } from 'jollections';

const list = new SinglyLinkedList();
list.addFirst(1);
list.addFirst(0);
list.addLast(2);

Using in CommonJs environment:

const { PriorityQueue } = require('jollections');

const queue = new PriorityQueue((a, b) => a.weight - b.weight);

queue.enqueue({ vertex: 'A', weight: 2 });
queue.enqueue({ vertex: 'B', weight: 6 });
queue.enqueue({ vertex: 'C', weight: 1 });
queue.enqueue({ vertex: 'D', weight: 3 });

const nearestNeighbor = queue.dequeue();
console.log(nearestNeighbor); // { vertex: 'C', weight: 1 }

To use it in browser just import script from unpkg inside your HTML and use it under Jollections namespace:

<script src="https://unpkg.com/[email protected]/dist/bundle.umd.js"></script>
<script>
  const { CircularLinkedList } = Jollections;
  const linkedList = new CircularLinkedList();

  linkedList.addLast(1);
  linkedList.addLast(2);
  linkedList.addLast(3);
  linkedList.addLast(4);

  console.log(linkedList.last()); // 4
  linkedList.rotate();
  console.log(linkedList.last()); // 1
  linkedList.rotate();
  console.log(linkedList.last()); // 2
</script>

Documentation

Soon...

Contribution

If you want to contribute, fork the repo, create your own branch (name does not matter as long as it makes sense) and start working. If Husky files are not executable by default make sure you make give them execute permission. It can be done by using following commands on Linux or Linux like environments:

chmod ug+x .husky/*
chmod ug+x .git/hooks/*

It will make sure that our Git hooks work properly. Hooks will check your commit messages and will run linter on each commit. Make sure your commits match conventional commits or your changes will not be accepted.

jollections's People

Contributors

orkhan-huseyn avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

aykhanhuseyn

jollections's Issues

Stuff to be added

Data Structures

  • SinglyLinkedList
  • DoublyLinkedList
  • CircularLinkedList
  • Queue (using SinglyLinkedList)
  • Stack (using SinglyLinkedList)
  • Deque (using SinglyLinkedList)
  • PriorityQueue (heap implementation)
  • Trie (TODO: suggest and startsWith methods)
  • UnionFind
  • QuickUnion
  • RankedUnionFind
  • BinarySearchTree (a balanced one ๐Ÿ˜Š )
  • OrderedSet (probably will utilize BST)
  • OrderedMap (probably will utilize BST)
  • LRUMap
  • LFUMap

Algorithms

  • binarySearch
  • reverse

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.