Do you envy C++ with STL, Python with collections, and Java with java.util ? Well, no need to envy anymore! JavaScript and TypeScript now have data-structure-typed.
Now you can use this library in Node.js and browser environments in CommonJS(require export.modules = ), ESModule(import export), Typescript(import export), UMD(var Queue = dataStructureTyped.Queue)
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.
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.
Adhere to ES6 and ESNext standard naming conventions for APIs.
Standardize API conventions by using 'add' and 'delete' for element manipulation methods in all data structures.
Opt for concise and clear method names, avoiding excessive length while ensuring explicit intent.
Object-oriented programming(OOP)
By strictly adhering to object-oriented design (BinaryTree -> BST -> AVLTree -> TreeMultimap), you can seamlessly
inherit the existing data structures to implement the customized ones you need. Object-oriented design stands as the
optimal approach to data structure design.