Skip to content

santiagoroca/js-data-structures

Repository files navigation

JStandard Build Status codecov HitCount

JStandard offers standard data structures for javascript, paying attention to performance and developer-friendly usage.

Javascript developer pays little to none attention to the correct usage of Data Structures since most of them are not (well) coded, are not performant or easy to use. This library aims to cover the most common Data Structures covered by a sweet suit of unit tests!

Structures Available

Usage Example


import { tree } from 'jstandard';

//Create a new Binary Search Tree
const binarySearchTree = new tree.BinarySearchTree();

//Set iteration mode to desired mode
binarySearchTree.setIterationMode(tree.BinarySearchTree.INORDER);

//Insert random values
binarySearchTree.insert(1); 
binarySearchTree.insert(4); 
binarySearchTree.insert(3); 
binarySearchTree.insert(6); 
binarySearchTree.insert(7);
binarySearchTree.insert(2); 
binarySearchTree.insert(3); 
binarySearchTree.insert(9); 
binarySearchTree.insert(19); 
binarySearchTree.insert(20); 
binarySearchTree.insert(3); 
binarySearchTree.insert(15);

//Iterate natively
for (let node of binarySearchTree) {
	console.log(node.value);
}

// OUPUT 1 2 3 3 3 4 6 7 9 15 19 20

Usage Example

<script src="node_modules/jstandard/build/jstandard.js"></script>
<script>
    //Create a new Binary Search Tree
    const binarySearchTree = new JStandard.tree.BinarySearchTree();

    //Set iteration mode to desired mode
    binarySearchTree.setIterationMode(JStandard.tree.BinarySearchTree.INORDER);

    //Insert random values
    binarySearchTree.insert(1);
    binarySearchTree.insert(4);
    binarySearchTree.insert(3);
    binarySearchTree.insert(6);
    binarySearchTree.insert(7);
    binarySearchTree.insert(2);
    binarySearchTree.insert(3);
    binarySearchTree.insert(9);
    binarySearchTree.insert(19);
    binarySearchTree.insert(20);
    binarySearchTree.insert(3);
    binarySearchTree.insert(15);

    //Iterate natively
    for (let node of binarySearchTree) {
    	console.log(node.value);
    }

    // OUPUT 1 2 3 3 3 4 6 7 9 15 19 20
</script>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published