0.5.0 • Published 8 years ago

algojs-collections v0.5.0

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
8 years ago

algojs-collections

Fundamental data structures in Javascript.

npm version Build Status Coverage Status

API docs

API docs published here.

List

An highly optimized immutable linked list which grows by prepending elements.

var algojs = require('algojs-collections');

var list1 = new algojs.List();
var list3 = new algojs.List('is', 'nice');

// prepend an element
var list4 = list3.cons('bike');
var list2 = list1.cons('a').cons('Riding');

// prepend a prefix list
var list5 = list4.concat(list2);

var println = function(elem) { console.log(elem); };
list5.foreach(println);

Stack

A mutable stack which grows like a linked list

var algojs = require('algojs-collections');

var stack = new algojs.Stack();
stack.push('hello');
stack.push('folks');

var folks = stack.pop();
0.5.0

8 years ago

0.4.0

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago