0.0.9 • Published 7 years ago

algs4js v0.0.9

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Algorithms and Data Structures with ES6

This repo contains basic algorithms and data structures implemented with ES6.

It provides the following features:

  • Basic Algorithms with Data Structures
  • Sorting: quicksort, mergesort, heapsort
  • Dynamic Programming: factorial, max sub array
  • Misc
    • String interview questions (reverse, palindrome)
    • Decimal-to-Roman-Numeral conversion
    • Chess knight shortest path
  • Code written in ES6
  • Babel transpiling through a simple gulp task
  • Linting with eslint using the AirBnB rules
  • Unit tests with mocha
  • Test coverage metrics with instanbul
  • Latest modules used for all dependencies, including babel v6
  • JSDoc style comments used to document the code

Functionality

FunctionAlgorithmES5 RequiresES6 Import
SortingQuick Sortvar QuickSort = require('algs4j').QuickSortimport { QuickSort} from 'algs4j'
SortingMerge Sortvar MergeSort = require('algs4j').MergeSortimport { MergeSort} from 'algs4j'
SortingHeap Sortvar HeapSort = require('algs4j').HeapSortimport { HeapSort} from 'algs4j'
Dynamic ProgrammingFactorialvar Factorial = require('algs4j').Factorialimport { Factorial} from 'algs4j'
Dynamic ProgrammingMax Sub Arrayvar MaxSubArray = require('algs4j').MaxSubArrayimport { MaxSubArray } from 'algs4j'
Misc String AlgsPalindrome, Reversevar SimpleStringAlgs = require('algs4j').SimpleStringAlgsimport { SimpleStringAlgs } from 'algs4j'
Misc Decimal to RomanConversionvar DecimalToRomanNumeral = require('algs4j').DecimalToRomanNumeralimport { DecimalToRomanNumeral } from 'algs4j'
Misc Knight's Shortest PathBreadth First Searchvar KnightShortestPath = require('algs4j').KnightShortestPathimport { KnightShortestPath } from 'algs4j'

Usage

import { QuickSort } from 'algs4j';

const arr = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
console.log(`Unsorted Arr: ${arr}`);
QuickSort.sort(arr);
console.log(`Sorted Arr: ${arr}`);
// arr is now [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
0.0.9

7 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago