test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
10,000 add randomly | 28.01 | 35.70 | 3.60e-4 |
10,000 add & delete randomly | 68.19 | 14.66 | 0.00 |
10,000 addMany | 34.37 | 29.10 | 3.01e-4 |
10,000 get | 28.61 | 34.96 | 2.81e-4 |
Data Structure | Unit Test | Performance Test | API Docs |
---|---|---|---|
Binary Tree | View | ||
Binary Search Tree (BST) | View | ||
AVL Tree | View | ||
Red Black Tree | View | ||
Tree Multiset | View | ||
Segment Tree | View | ||
Binary Indexed Tree | View | ||
Heap | View | ||
Priority Queue | View | ||
Max Priority Queue | View | ||
Min Priority Queue | View | ||
Trie | View | ||
Graph | View | ||
Directed Graph | View | ||
Undirected Graph | View | ||
Queue | View | ||
Deque | View | ||
Hash Map | View | ||
Linked List | View | ||
Singly Linked List | View | ||
Doubly Linked List | View | ||
Stack | View |
Data Structure Typed | C++ STL | java.util | Python collections |
---|---|---|---|
Heap<E> | priority_queue<T> | PriorityQueue<E> | heapq |
Deque<E> | deque<T> | ArrayDeque<E> | deque |
Queue<E> | queue<T> | Queue<E> | - |
HashMap<K, V> | unordered_map<K, V> | HashMap<K, V> | defaultdict |
DoublyLinkedList<E> | list<T> | LinkedList<E> | - |
SinglyLinkedList<E> | - | - | - |
BinaryTree<K, V> | - | - | - |
BST<K, V> | - | - | - |
RedBlackTree<E> | set<T> | TreeSet<E> | - |
RedBlackTree<K, V> | map<K, V> | TreeMap<K, V> | - |
TreeMultimap<K, V> | multimap<K, V> | - | - |
- | multiset<T> | - | - |
Trie | - | - | - |
DirectedGraph<V, E> | - | - | - |
UndirectedGraph<V, E> | - | - | - |
PriorityQueue<E> | priority_queue<T> | PriorityQueue<E> | - |
Array<E> | vector<T> | ArrayList<E> | list |
Stack<E> | stack<T> | Stack<E> | - |
Set<E> | - | HashSet<E> | set |
HashMap<K, V> | - | HashMap<K, V> | dict |
- | unordered_set<T> | HashSet<E> | - |
Map<K, V> | - | - | OrderedDict |
- | unordered_multiset | - | Counter |
- | - | LinkedHashSet<E> | - |
LinkedHashMap<K, V> | - | LinkedHashMap<K, V> | - |
- | unordered_multimap<K, V> | - | - |
- | bitset<N> | - | - |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
10,000 add randomly | 28.01 | 35.70 | 3.60e-4 |
10,000 add & delete randomly | 68.19 | 14.66 | 0.00 |
10,000 addMany | 34.37 | 29.10 | 3.01e-4 |
10,000 get | 28.61 | 34.96 | 2.81e-4 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000 add randomly | 13.78 | 72.57 | 9.19e-5 |
1,000 add & delete randomly | 21.50 | 46.52 | 1.81e-4 |
1,000 addMany | 15.91 | 62.85 | 1.16e-4 |
1,000 get | 18.16 | 55.08 | 1.86e-4 |
1,000 has | 18.16 | 55.06 | 1.82e-4 |
1,000 dfs | 161.46 | 6.19 | 5.35e-4 |
1,000 bfs | 56.32 | 17.76 | 4.17e-4 |
1,000 morris | 257.59 | 3.88 | 6.92e-4 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
10,000 add randomly | 26.94 | 37.12 | 2.41e-4 |
10,000 add & delete randomly | 69.33 | 14.42 | 5.46e-4 |
10,000 addMany | 28.17 | 35.50 | 3.03e-4 |
10,000 get | 31.40 | 31.85 | 2.49e-4 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
100,000 add | 84.95 | 11.77 | 0.00 |
100,000 add & delete randomly | 214.08 | 4.67 | 0.00 |
100,000 getNode | 43.21 | 23.14 | 3.41e-4 |
100,000 add & iterator | 115.98 | 8.62 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
SRC PQ 10,000 add | 0.14 | 6958.08 | 1.96e-6 |
CJS PQ 10,000 add | 0.14 | 6945.48 | 1.85e-6 |
MJS PQ 10,000 add | 0.57 | 1758.67 | 6.72e-6 |
SRC PQ 10,000 add & pop | 3.41 | 293.06 | 3.56e-5 |
CJS PQ 10,000 add & pop | 3.40 | 293.88 | 3.65e-5 |
MJS PQ 10,000 add & pop | 3.30 | 302.86 | 3.70e-5 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000 addVertex | 0.10 | 9990.48 | 1.15e-6 |
1,000 addEdge | 6.30 | 158.81 | 7.72e-4 |
1,000 getVertex | 0.05 | 2.15e+4 | 3.77e-7 |
1,000 getEdge | 22.56 | 44.33 | 0.00 |
tarjan | 213.11 | 4.69 | 0.01 |
tarjan all | 212.23 | 4.71 | 9.29e-4 |
topologicalSort | 170.96 | 5.85 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000,000 set | 120.97 | 8.27 | 0.05 |
1,000,000 Map set | 217.88 | 4.59 | 0.03 |
1,000,000 Set add | 171.45 | 5.83 | 0.02 |
1,000,000 set & get | 116.49 | 8.58 | 0.02 |
1,000,000 Map set & get | 271.49 | 3.68 | 0.02 |
1,000,000 Set add & has | 173.05 | 5.78 | 0.02 |
1,000,000 ObjKey set & get | 314.33 | 3.18 | 0.04 |
1,000,000 Map ObjKey set & get | 275.93 | 3.62 | 0.06 |
1,000,000 Set ObjKey add & has | 277.40 | 3.60 | 0.08 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
100,000 add & pop | 80.18 | 12.47 | 0.00 |
100,000 add & dfs | 35.40 | 28.25 | 0.00 |
10,000 fib add & pop | 360.71 | 2.77 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000,000 push | 242.04 | 4.13 | 0.04 |
1,000,000 unshift | 204.37 | 4.89 | 0.03 |
1,000,000 unshift & shift | 178.89 | 5.59 | 0.03 |
1,000,000 insertBefore | 325.64 | 3.07 | 0.07 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
10,000 push & pop | 216.93 | 4.61 | 0.02 |
10,000 insertBefore | 247.43 | 4.04 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
10,000 refill & poll | 8.92 | 112.15 | 1.68e-4 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
100,000 add & pop | 101.57 | 9.85 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000,000 push | 13.83 | 72.30 | 1.57e-4 |
1,000,000 push & pop | 22.78 | 43.90 | 4.69e-4 |
1,000,000 push & shift | 23.80 | 42.02 | 1.75e-4 |
1,000,000 unshift & shift | 22.04 | 45.37 | 2.74e-4 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000,000 push | 39.17 | 25.53 | 0.00 |
1,000,000 push & shift | 82.12 | 12.18 | 0.00 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
1,000,000 push | 40.20 | 24.88 | 0.01 |
1,000,000 push & pop | 49.27 | 20.30 | 0.01 |
test name | time taken (ms) | executions per sec | sample deviation |
---|---|---|---|
100,000 push | 45.29 | 22.08 | 6.76e-4 |
100,000 getWords | 86.68 | 11.54 | 0.00 |
Algorithm | Function Description | Iteration Type |
---|---|---|
Binary Tree DFS | Traverse a binary tree in a depth-first manner, starting from the root node, first visiting the left subtree, and then the right subtree, using recursion. | Recursion + Iteration |
Binary Tree BFS | Traverse a binary tree in a breadth-first manner, starting from the root node, visiting nodes level by level from left to right. | Iteration |
Graph DFS | Traverse a graph in a depth-first manner, starting from a given node, exploring along one path as deeply as possible, and backtracking to explore other paths. Used for finding connected components, paths, etc. | Recursion + Iteration |
Binary Tree Morris | Morris traversal is an in-order traversal algorithm for binary trees with O(1) space complexity. It allows tree traversal without additional stack or recursion. | Iteration |
Graph BFS | Traverse a graph in a breadth-first manner, starting from a given node, first visiting nodes directly connected to the starting node, and then expanding level by level. Used for finding shortest paths, etc. | Recursion + Iteration |
Graph Tarjan's Algorithm | Find strongly connected components in a graph, typically implemented using depth-first search. | Recursion |
Graph Bellman-Ford Algorithm | Finding the shortest paths from a single source, can handle negative weight edges | Iteration |
Graph Dijkstra's Algorithm | Finding the shortest paths from a single source, cannot handle negative weight edges | Iteration |
Graph Floyd-Warshall Algorithm | Finding the shortest paths between all pairs of nodes | Iteration |
Graph getCycles | Find all cycles in a graph or detect the presence of cycles. | Recursion |
Graph getCutVertexes | Find cut vertices in a graph, which are nodes that, when removed, increase the number of connected components in the graph. | Recursion |
Graph getSCCs | Find strongly connected components in a graph, which are subgraphs where any two nodes can reach each other. | Recursion |
Graph getBridges | Find bridges in a graph, which are edges that, when removed, increase the number of connected components in the graph. | Recursion |
Graph topologicalSort | Perform topological sorting on a directed acyclic graph (DAG) to find a linear order of nodes such that all directed edges go from earlier nodes to later nodes. | Recursion |
Principle | Description |
---|---|
Practicality | Follows ES6 and ESNext standards, offering unified and considerate optional parameters, and simplifies method names. |
Extensibility | Adheres to OOP (Object-Oriented Programming) principles, allowing inheritance for all data structures. |
Modularization | Includes data structure modularization and independent NPM packages. |
Efficiency | All methods provide time and space complexity, comparable to native JS performance. |
Maintainability | Follows open-source community development standards, complete documentation, continuous integration, and adheres to TDD (Test-Driven Development) patterns. |
Testability | Automated and customized unit testing, performance testing, and integration testing. |
Portability | Plans for porting to Java, Python, and C++, currently achieved to 80%. |
Reusability | Fully decoupled, minimized side effects, and adheres to OOP. |
Security | Carefully designed security for member variables and methods. Read-write separation. Data structure software does not need to consider other security aspects. |
Scalability | Data structure software does not involve load issues. |