Do you envy C++ with STL (std::), Python with collections, and Java with java.util ? Well, no need to envy
anymore! JavaScript and TypeScript now have data-structure-typed.Benchmark compared with C++ STL. *
API standards* aligned with ES6 and Java. Usability is comparable to Python
Data structures available
We provide data structures that are not available in JS/TS
Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, Directed Graph, Undirected Graph, BST, AVL Tree, Priority
Queue, Queue, Tree Multiset.
Performance
Performance surpasses that of native JS/TS
Method
Time Taken
Data Scale
Belongs To
Complexity
Queue.push & shift
5.83 ms
100,000
Ours
O(1)
Array.push & shift
2829.59 ms
100,000
Native JS
O(n)
Deque.unshift & shift
2.44 ms
100,000
Ours
O(1)
Array.unshift & shift
4750.37 ms
100,000
Native JS
O(n)
HashMap.set
122.51 ms
1,000,000
Ours
O(1)
Map.set
223.80 ms
1,000,000
Native JS
O(1)
Set.add
185.06 ms
1,000,000
Native JS
O(1)
Conciseness and uniformity
In Java.utils, you need to memorize a table for all sequential data structures(Queue, Deque, LinkedList),
Operation
Java ArrayList
Java Queue
Java ArrayDeque
Java LinkedList
push
add
offer
push
push
pop
remove
poll
removeLast
removeLast
shift
remove
poll
removeFirst
removeFirst
unshift
add(0, element)
offerFirst
unshift
unshift
whereas in our data-structure-typed, you only need to remember four methods: push, pop, shift, and unshift for all sequential data structures.
The corresponding relationships between data structures in different language standard libraries.
Data Structure Typed
C++ STL
java.util
Python collections
Heap<E>
-
-
heapq
PriorityQueue<E>
priority_queue<T>
PriorityQueue<E>
-
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>
-
-
TreeMultiMap<E>
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>
-
HashMap<E>
unordered_set<T>
HashSet<E>
set
-
unordered_multiset
-
Counter
LinkedHashMap<K, V>
-
LinkedHashMap<K, V>
OrderedDict
-
unordered_multimap<K, V>
-
-
-
bitset<N>
-
-
Built-in classic algorithms
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 getCutVertices
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
Software Engineering Design Standards
We strictly adhere to computer science theory and software development standards. Our LinkedList is designed in the
traditional sense of the LinkedList data structure, and we refrain from substituting it with a Deque solely for the
purpose of showcasing performance test data. However, we have also implemented a Deque based on a dynamic array
concurrently.
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.