diff --git a/README.md b/README.md index c1d1044..04d4b67 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ anymore! JavaScript and TypeScript now have [data-structure-typed]().**`Benchmar ### We provide data structures that are not available in JS/TS -Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undirected Graph, BST, AVL Tree, Priority Queue, Queue, Tree Multiset. +Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, Directed Graph, Undirected Graph, BST, AVL Tree, Priority Queue, Queue, Tree Multiset. ### Performance surpasses that of native JS/TS @@ -41,6 +41,7 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi Time Taken (ms) Scale Belongs To + Time Complexity @@ -49,42 +50,49 @@ Heap, Binary Tree, RedBlack Tree, Linked List, Deque, Trie, Directed Graph, Undi 5.83 100,000 data-structure-typed + O(1) Array.push & shift 2829.59 100,000 Native JS + O(n) Deque.unshift & shift 2.44 100,000 data-structure-typed + O(1) Array.unshift & shift 4750.37 100,000 Native JS + O(n) HashMap.set 122.51 1,000,000 data-structure-typed + O(1) Map.set 223.80 1,000,000 Native JS + O(1) Set.add 185.06 1,000,000 Native JS + O(1) @@ -105,9 +113,9 @@ yarn add data-structure-typed ```js import { - BinaryTree, Graph, Queue, Stack, PriorityQueue, BST, Trie, DoublyLinkedList, - AVLTree, MinHeap, SinglyLinkedList, DirectedGraph, TreeMultimap, - DirectedVertex, AVLTreeNode + Heap, Graph, Queue, Deque, PriorityQueue, BST, Trie, DoublyLinkedList, + AVLTree, SinglyLinkedList, DirectedGraph, RedBlackTree, TreeMultimap, + DirectedVertex, Stack, AVLTreeNode } from 'data-structure-typed'; ``` @@ -140,7 +148,7 @@ our [visual tool](https://github.com/zrwusa/vivid-algorithm) ## Code Snippets -### RedBlackTree snippet +### Red Black Tree snippet #### TS @@ -931,43 +939,43 @@ We strictly adhere to computer science theory and software development standards [//]: # (No deletion!!! Start of Replace Section)
avl-tree
-
test nametime taken (ms)executions per secsample deviation
10,000 add randomly126.827.880.01
10,000 add & delete randomly186.365.370.00
10,000 addMany133.157.510.00
10,000 get50.6519.745.59e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 add randomly132.617.540.03
10,000 add & delete randomly179.825.560.00
10,000 addMany128.847.767.04e-4
10,000 get48.4020.663.34e-4
binary-tree-overall
-
test nametime taken (ms)executions per secsample deviation
10,000 RBTree add6.12163.481.94e-4
10,000 RBTree add & delete randomly15.4664.703.64e-4
10,000 RBTree get19.9850.060.00
10,000 AVLTree add130.407.670.02
10,000 AVLTree add & delete randomly193.645.160.01
10,000 AVLTree get0.991005.443.95e-5
+
test nametime taken (ms)executions per secsample deviation
10,000 RBTree add5.84171.128.80e-5
10,000 RBTree add & delete randomly16.3061.340.01
10,000 RBTree get19.8050.500.00
10,000 AVLTree add122.948.130.00
10,000 AVLTree add & delete randomly185.435.390.00
10,000 AVLTree get0.961044.696.87e-6
rb-tree
-
test nametime taken (ms)executions per secsample deviation
100,000 add90.7211.020.03
100,000 add & delete randomly228.774.370.02
100,000 getNode192.255.205.16e-4
100,000 add & iterator112.498.890.01
+
test nametime taken (ms)executions per secsample deviation
100,000 add79.3912.600.00
100,000 add & delete randomly211.764.720.00
100,000 getNode169.345.916.62e-4
100,000 add & iterator112.028.930.01
directed-graph
-
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.119250.941.22e-5
1,000 addEdge6.35157.512.88e-4
1,000 getVertex0.052.06e+48.69e-6
1,000 getEdge23.0243.430.00
tarjan213.854.680.01
tarjan all6674.110.150.28
topologicalSort179.095.580.00
+
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.109590.361.32e-6
1,000 addEdge6.19161.684.32e-4
1,000 getVertex0.052.16e+43.75e-7
1,000 getEdge24.7240.450.01
tarjan226.084.420.01
tarjan all6667.550.150.27
topologicalSort186.595.360.00
hash-map
-
test nametime taken (ms)executions per secsample deviation
1,000,000 set131.277.620.05
Native Map 1,000,000 set267.343.740.04
Native Set 1,000,000 add207.034.830.06
1,000,000 set & get132.197.560.03
Native Map 1,000,000 set & get276.303.620.01
Native Set 1,000,000 add & has187.745.330.02
1,000,000 ObjKey set & get336.392.970.03
Native Map 1,000,000 ObjKey set & get394.472.540.09
Native Set 1,000,000 ObjKey add & has295.483.380.04
+
test nametime taken (ms)executions per secsample deviation
1,000,000 set137.007.300.08
Native Map 1,000,000 set236.584.230.05
Native Set 1,000,000 add187.785.330.05
1,000,000 set & get123.918.070.04
Native Map 1,000,000 set & get286.033.500.03
Native Set 1,000,000 add & has188.675.300.03
1,000,000 ObjKey set & get327.703.050.05
Native Map 1,000,000 ObjKey set & get285.223.510.05
Native Set 1,000,000 ObjKey add & has278.083.600.07
heap
-
test nametime taken (ms)executions per secsample deviation
100,000 add & poll24.1841.356.43e-4
100,000 add & dfs33.6429.720.00
10,000 fib add & pop363.382.750.00
+
test nametime taken (ms)executions per secsample deviation
100,000 add & poll23.9941.680.00
100,000 add & dfs33.2330.090.00
10,000 fib add & pop358.162.790.00
doubly-linked-list
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push220.164.540.03
1,000,000 unshift210.844.740.05
1,000,000 unshift & shift189.595.270.07
1,000,000 addBefore412.742.420.17
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push229.074.370.06
1,000,000 unshift217.644.590.08
1,000,000 unshift & shift175.135.710.04
1,000,000 addBefore342.222.920.08
singly-linked-list
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push & shift252.063.970.09
10,000 push & pop230.294.340.01
10,000 addBefore261.573.820.01
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push & shift210.654.750.06
10,000 push & pop214.544.660.01
10,000 addBefore248.454.020.01
priority-queue
-
test nametime taken (ms)executions per secsample deviation
100,000 add & poll75.7113.218.95e-4
+
test nametime taken (ms)executions per secsample deviation
100,000 add & poll75.6713.220.00
deque
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push25.1839.710.01
1,000,000 push & pop33.5229.830.01
100,000 push & shift3.61276.965.50e-4
Native Array 100,000 push & shift2703.160.370.11
100,000 unshift & shift3.73268.148.29e-4
Native Array 100,000 unshift & shift4767.610.210.40
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push13.1476.131.36e-4
10,000 push & delete4716.790.210.13
1,000,000 push & pop22.3844.680.00
100,000 push & shift2.15464.201.98e-5
Native Array 100,000 push & shift2241.300.450.14
100,000 unshift & shift2.34426.690.00
Native Array 100,000 unshift & shift3971.320.250.18
queue
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push50.5619.780.01
100,000 push & shift5.99166.850.00
Native Array 100,000 push & shift2962.430.340.29
Native Array 100,000 push & pop4.49222.693.01e-4
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push44.8022.320.01
100,000 push & shift4.91203.641.15e-4
Native Array 100,000 push & shift2116.780.470.12
Native Array 100,000 push & pop4.30232.299.32e-5
stack
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push59.6816.760.03
1,000,000 push & pop52.0419.220.01
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push42.1523.720.00
1,000,000 push & pop52.9018.900.02
trie
-
test nametime taken (ms)executions per secsample deviation
100,000 push47.7020.960.00
100,000 getWords66.5315.030.00
+
test nametime taken (ms)executions per secsample deviation
100,000 push44.5522.458.46e-4
100,000 getWords87.4811.430.00
[//]: # (No deletion!!! End of Replace Section) diff --git a/package.json b/package.json index 3acbf2f..ee65e6f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "data-structure-typed", "version": "1.50.0", - "description": "Data Structures of Javascript & TypeScript. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree(BST), AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack. Benchmark compared with C++ STL. API aligned with ES6 and Java.util. Usability is comparable to Python", + "description": "Javascript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree(BST), AVL Tree, Priority Queue, Graph, Queue, Tree Multiset, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue, Stack. Benchmark compared with C++ STL. API aligned with ES6 and Java.util. Usability is comparable to Python", "main": "dist/cjs/index.js", "module": "dist/mjs/index.js", "types": "dist/mjs/index.d.ts", @@ -92,17 +92,14 @@ "typescript": "^5.3.2" }, "keywords": [ + "data structure", + "data-structure", + "datastructure", + "javascript data structure", + "typescript data structure", + "js data structure", "data", "structure", - "structures", - "data structure", - "datastructure", - "data-structure", - "data structures", - "datastructures", - "data-structures", - "in data structures", - "in data structure", "binary", "depth", "breadth", @@ -112,7 +109,7 @@ "avl", "red", "black", - "redblack", + "red black", "RB", "segment", "prefix", @@ -150,7 +147,6 @@ "Python", "collections", "Python Collections", - "pythoncollections", "python-collections", "C#", "System.Collections.Generic", @@ -159,41 +155,30 @@ "Java", "util", "binary search tree", - "binarysearchtree", "binary-search-tree", "BST", "binary tree", - "binarytree", "binary-tree", "red black tree", - "redblacktree", - "redblack tree", + "red black tree", "red-black-tree", - "redblack-tree", + "rb tree", "trie", "prefix tree", - "prefixtree", "prefix-tree", "avl tree", - "avltree", "avl-tree", "tree set", - "treeset", "tree-set", "tree multiset", - "treemultiset", "tree-multiset", "tree map", - "treemap", "tree-map", "tree multimap", - "treemultimap", "tree-multimap", "binary indexed tree", - "binaryindexedtree", "binary-indexed-tree", "segment tree", - "segmenttree", "segment-tree", "sort", "sorted", @@ -203,60 +188,46 @@ "morris", "Morris", "bellman ford", - "bellmanford", "bellman-ford", "dijkstra", "Dijkstra", "floyd warshall", - "floydwarshall", "floyd-warshall", "tarjan", "tarjan's", "dfs", "depth first Search", - "depthfirstSearch", "depth-first-Search", "bfs", "breadth first search", - "breadthfirstsearch", "dfs iterative", "recursive", "iterative", "directed graph", - "directedgraph", "directed-graph", "undirected graph", - "undirectedgraph", "undirected-graph", "min heap", - "minheap", "min-heap", "max heap", - "maxheap", "max-heap", "priority queue", - "priorityqueue", "priority-queue", "max priority queue", - "maxpriorityqueue", "max-priority-queue", "min priority queue", - "minpriorityqueue", "min-priority-queue", "hash", "map", - "hash map", "hashmap", + "hash map", "hash-map", "deque", "linked list", - "linkedlist", "linked-list", "singly linked list", - "singlylinkedlist", "singly-linked-list", "doubly linked list", - "doublylinkedlist", "doubly-linked-list", "stack", "CommonJS",