@hyperinactive/data-structs-js

1.2.0 • Public • Published

data-structs-js

Implementation of common data structures into Javascript.

Structures included in the package:

- Stack
- Queue
- Singly linked list
- Doubly linked list
- Binary search tree
- AVL tree
- Hash table
- Hash map
- Min heap
- Max heap
- Graph

Instalation

npm install @hyperinactive/data-structs-js

Usage

Simply import a data structure from the module

e.g. const { Stack } = require('@hyperinactive/data-structs-js');

List of functions per structure

Stack

  • push
  • pop
  • getIndex
  • peek
  • reverse
  • isEmpty
  • length
  • clone
  • print

Queue

  • enqueue
  • dequeue
  • peek
  • poll
  • isEmpty
  • size
  • clone
  • print

Singly and Doubly linked list

  • getHead
  • getTail (Doubly)
  • getSize
  • add
  • removeByIndex
  • removeByValue
  • indexOf
  • forEach
  • clear
  • reverse
  • isEmpty
  • clone
  • print

Binary search and AVL tree

  • insert
  • remove
  • getDepth
  • getHeight
  • find
  • getMinNode
  • getMaxNode
  • clone
  • print

Hash table and map

  • put
  • get
  • remove
  • update
  • union
  • getCurrentLoad
  • getSize
  • forEach
  • clone
  • print

Min and max heap

  • insert
  • remove
  • heapify
  • peek
  • getSize
  • getParent
  • getLeftChild
  • getRightChild
  • isLeaf
  • swap
  • clear
  • print

Graph

  • addVertex
  • addEdge
  • removeVertex
  • removeEdge
  • removeAllEdges
  • bfs
  • dfs
  • print

Package Sidebar

Install

npm i @hyperinactive/data-structs-js

Weekly Downloads

7

Version

1.2.0

License

MIT

Unpacked Size

52.6 kB

Total Files

18

Last publish

Collaborators

  • hyperinactive