Skip to content

Javascript Library of algorithms and data structures created to refine algorithm skills

License

Notifications You must be signed in to change notification settings

aa-wong/algo.js

Repository files navigation

algo.js

Javascript Library of algorithms and data structures created to refine algorithm skills.

Features

  • Data Structures

    • BinarySearchTree
    • Graph
    • linkedLists
      • LinkedList
      • DoublyLinkedList
    • queues
      • ArrayQueue
      • LinkedListQueue
    • stacks
      • ArrayStack
      • LinkedListStack
  • Algorithms

    • sorting
      • bubbleSort
      • heapSort
      • insertionSort
      • mergeSort
      • quickSort
      • selectionSort
    • search
      • binarySearch

Getting started

Use the algo.min.js file found in the lib directory.

/**
 * Import library
 */
import {
  dataStructures,
  algorithms
} from './algo.min.js';

/**
 * Data Structures
 */
const {
  BinarySearchTree,
  Graph,
  linkedLists,
  queues,
  stacks
} = dataStructures;

const bst = new BinarySearchTree();

const stack = new stacks.StackLinkedList();

/**
 * Array Sorting Algorithms
 */
const {
  mergeSort
} = algorithms.sorting;

const sortedArray = mergeSort([10, 6, 14, 3, 22, 4, 3, 8, 11, 12]);

/**
 * sorted array search algorithms
 */
const {
  binarySearch
} = algorithms.search;

const value = binarySearch([2, 3, 4, 6, 8, 10, 11, 12, 14, 22], 12);

About

Javascript Library of algorithms and data structures created to refine algorithm skills

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published