npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tomasperezv/data-structures

v0.2.0

Published

Experiments with data structures.

Downloads

4

Readme

CS Data Structures and Algorithms

Data structures and Algorithms implemented in Javascript.

Author

Tomas Perez - [email protected]

http://www.tomasperez.com

Installation

$ npm install

Run the tests

If you want to run the tests, you need to install mocha globally:

$ npm install -g mocha

Then you can run the tests:

$ npm test

  BinaryOperator
    getBit
      ✓ Returning bits 
    setBit
      ✓ Setting bits 
    clearBit
      ✓ Clearing bits 

  Insertion sort
    ✓ Trivial cases 
    ✓ Non trivial cases 

  Merge sort
    ✓ Already sorted array 
    ✓ Non trivial cases 

  Quick sort
    ✓ Partition method 
    ✓ Already sorted array 
    ✓ Non trivial cases 

  Two Sum
    ✓ Basic tests 

  BFS
    Solve algorithm
      ✓ BFS simple search 

  Closest leaf
    Solve algorithm
      ✓ Determine the closest leaf in a binary tree 

  DFS
    Solve algorithm
      ✓ DFS simple search, iterative version 
      ✓ DFS simple search, recursive version 

  Dijkstra
    Error handling
      ✓ Empty graph 
    Solve algorithm
      ✓ Single source path search: one vertex 
      ✓ Single source path search: multiple nodes 

  LargestCommonSubstring
    The algorithm works as expected
      ✓ Basic cases 

  LargestOfTwoNumbers
    The algorithm works as expected
      ✓ Basic cases 

  Min Height in binary trees
    Solve
      ✓ Empty BinaryTrees 
      ✓ Basic cases 

  SortedArrayToBST
    The algorithm works as expected
      ✓ Basic cases 
      ✓ Edge cases 

  TreeTraverse
    In Order
      ✓ Traverses properly a binary tree in-order 
      ✓ Traverses properly a binary tree post-order 
      ✓ Traverses properly a binary tree in-order 

  BinaryTree
    Creation
      ✓ Empty BinarySearchTree 
      ✓ Simple BinarySearchTree 
    Inserting elements in a Binary Search Tree
      ✓ Basic insertion 
    Get largest element in a Binary Search Tree
      ✓ Construct the BST and search for the largest 

  BinaryTree
    Creation
      ✓ Empty BinaryTrees 
      ✓ Leave values must be BinaryTreeNode 
      ✓ Simple creation 

  DoubleLinkedList
    Insertion
      ✓ Simple insertion 
      ✓ Can not insert an invalid a value 
      ✓ Can insert multiples values 

  HashTable
    The data structure works as expected
      ✓ Keys validation 
      ✓ Insertion 
      ✓ Hash function 

  List
    isEmpty
      ✓ Checking if a list is empty 
    Insertion
      ✓ Simple insertion 
      ✓ Can not insert an invalid a value 
      ✓ Can insert multiples values 

  MinHeap
    The data structure works as expected
      ✓ Basic cases 

  Node
    Creation and initialization
      ✓ Simple creation 
      ✓ Can not initialize a node without a value 
    Handling previous node
      ✓ Can assign a value to the previous node 
      ✓ Can not assign invalid values to the previous node 
    Handling next node
      ✓ Can assign a value to the next node 
      ✓ Can not assign invalid values to the next node 

  SuffixTree
    Inserting words in a suffix tree
      ✓ Simple insertion and retrieval 
    Application of a suffix tree for computing common substrings
      ✓ Is q a substring of S 
      ✓ How many times does q appear in S 
      ✓ Longest common substring of S and q 

  Tree
    Creation
      ✓ Empty trees 
      ✓ isLeaf 
      ✓ Leave values must be TreeNode 
      ✓ Simple creation 

  Trie
    Inserting and retrieval
      ✓ Simple insertion and retrieval of words 

  60 passing (98ms)

License

Public Domain.

No warranty expressed or implied. Use at your own risk.