From e2f554fb5caabfe696c7caebb257053755106098 Mon Sep 17 00:00:00 2001 From: Revone Date: Tue, 16 Jan 2024 11:01:27 +0800 Subject: [PATCH] docs: re-organized --- README.md | 367 ++++++++++++++++++++++++---------------------- package-lock.json | 52 +++---- package.json | 10 +- 3 files changed, 226 insertions(+), 203 deletions(-) diff --git a/README.md b/README.md index d783492..29cfcce 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,35 @@ [//]: # (

English | 简体中文

) + +## Installation and Usage + +### npm + +```bash +npm i data-structure-typed --save +``` + +### yarn + +```bash +yarn add data-structure-typed +``` + +```js +import { + Heap, Graph, Queue, Deque, PriorityQueue, BST, Trie, DoublyLinkedList, + AVLTree, SinglyLinkedList, DirectedGraph, RedBlackTree, TreeMultiMap, + DirectedVertex, Stack, AVLTreeNode +} from 'data-structure-typed'; +``` + +If you only want to use a specific data structure independently, you can install it separately, for example, by running + +```bash +npm i heap-typed --save +``` + ## Why Do you envy C++ with [STL]() (std::), Python with [collections](), and Java with [java.util]() ? Well, no need to envy @@ -28,12 +57,6 @@ anymore! JavaScript and TypeScript now have [data-structure-typed]().**`Benchmar [//]: # (![Lines](https://img.shields.io/badge/lines-68.6%25-red.svg?style=flat)) -### Data structures available - -We provide data structures that are not available in JS/TS -[Heap](https://www.npmjs.com/package/heap-typed), [Binary Tree](https://www.npmjs.com/package/binary-tree-typed), [Red Black Tree](https://www.npmjs.com/package/red-black-tree-typed), [Linked List](https://www.npmjs.com/package/linked-list-typed), [Deque](https://www.npmjs.com/package/deque-typed), [Trie](https://www.npmjs.com/package/trie-typed), [Directed Graph](https://www.npmjs.com/package/directed-graph-typed), [Undirected Graph](https://www.npmjs.com/package/undirected-graph-typed), [BST](https://www.npmjs.com/package/bst-typed), [AVL Tree](https://www.npmjs.com/package/avl-tree-typed), [Priority -Queue](https://www.npmjs.com/package/priority-queue-typed), [Queue](https://www.npmjs.com/package/queue-typed), [Tree Multiset](https://www.npmjs.com/package/tree-multimap-typed). - ### Performance Performance surpasses that of native JS/TS @@ -143,27 +166,174 @@ In [java.utils](), you need to memorize a table for all sequential data structur whereas in our [data-structure-typed](), you **only** need to remember four methods: `push`, `pop`, `shift`, and `unshift` for all sequential data structures(Queue, Deque, DoublyLinkedList, SinglyLinkedList and Array). -## Installation and Usage +### Data structures available -### npm +We provide data structures that are not available in JS/TS -```bash -npm i data-structure-typed --save -``` - -### yarn - -```bash -yarn add data-structure-typed -``` - -```js -import { - Heap, Graph, Queue, Deque, PriorityQueue, BST, Trie, DoublyLinkedList, - AVLTree, SinglyLinkedList, DirectedGraph, RedBlackTree, TreeMultiMap, - DirectedVertex, Stack, AVLTreeNode -} from 'data-structure-typed'; -``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Data StructureUnit TestPerf TestAPI DocNPM
Binary TreeViewView
Binary Search Tree (BST)ViewView
AVL TreeViewView
Red Black TreeViewView
Tree MultimapViewView
HeapViewView
Priority QueueViewView
Max Priority QueueViewView
Min Priority QueueViewView
TrieViewView
GraphViewView
Directed GraphViewView
Undirected GraphViewView
QueueViewView
DequeViewView
Hash MapView
Linked ListViewView
Singly Linked ListViewView
Doubly Linked ListViewView
StackViewView
Segment TreeView
Binary Indexed TreeView
## Vivid Examples @@ -520,153 +690,6 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key) // ['A', 'B', ' Examples Repository -## Data Structures - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Data StructureUnit TestPerformance TestAPI Docs
Binary TreeView
Binary Search Tree (BST)View
AVL TreeView
Red Black TreeView
Tree MultimapView
HeapView
Priority QueueView
Max Priority QueueView
Min Priority QueueView
TrieView
GraphView
Directed GraphView
Undirected GraphView
QueueView
DequeView
Hash MapView
Linked ListView
Singly Linked ListView
Doubly Linked ListView
StackView
Segment TreeView
Binary Indexed TreeView
- ## Benchmark MacBook Pro (15-inch, 2018) diff --git a/package-lock.json b/package-lock.json index e1388eb..d03279f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "data-structure-typed", - "version": "1.51.2", + "version": "1.51.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "data-structure-typed", - "version": "1.51.2", + "version": "1.51.3", "license": "MIT", "devDependencies": { "@swc/core": "^1.3.96", @@ -16,11 +16,11 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "auto-changelog": "^2.4.0", - "avl-tree-typed": "^1.51.1", + "avl-tree-typed": "^1.51.2", "benchmark": "^2.1.4", - "binary-tree-typed": "^1.51.1", - "bst-typed": "^1.51.1", - "data-structure-typed": "^1.51.1", + "binary-tree-typed": "^1.51.2", + "bst-typed": "^1.51.2", + "data-structure-typed": "^1.51.2", "dependency-cruiser": "^14.1.0", "doctoc": "^2.2.1", "eslint": "^8.50.0", @@ -29,7 +29,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "fast-glob": "^3.3.1", - "heap-typed": "^1.51.1", + "heap-typed": "^1.51.2", "istanbul-badges-readme": "^1.8.5", "jest": "^29.7.0", "js-sdsl": "^4.4.2", @@ -3097,12 +3097,12 @@ } }, "node_modules/avl-tree-typed": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.51.1.tgz", - "integrity": "sha512-eOGCM8nPuZ07xsEKuDFraTQje6kp0Dc23qd2nJoC2EZbsCR9L4n33HL6Od0W1HjnRVO9q7uUc65PjRaFXviWfA==", + "version": "1.51.2", + "resolved": "https://registry.npmjs.org/avl-tree-typed/-/avl-tree-typed-1.51.2.tgz", + "integrity": "sha512-lH48F6SbRTlDEEB6k7TjqkdDpGoXmbnPcxHsEfOaeaKKRxuL1JpfyZCXpEIl8h/kz6dhe3UQYPfp6vKP57Sczw==", "dev": true, "dependencies": { - "data-structure-typed": "^1.51.0" + "data-structure-typed": "^1.51.2" } }, "node_modules/babel-jest": { @@ -3306,12 +3306,12 @@ } }, "node_modules/binary-tree-typed": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.51.1.tgz", - "integrity": "sha512-cd/2MyFMWtQOBc3QaaSvVm+M7G9r5st3h5AwLJifCUBhClsdTsOH73At2916J53TSLB09OQt/bUHbn5Qa0XbqQ==", + "version": "1.51.2", + "resolved": "https://registry.npmjs.org/binary-tree-typed/-/binary-tree-typed-1.51.2.tgz", + "integrity": "sha512-2gw8LHOAHq6TeVQvs9G7hR+34GDrU5fbb9Ip9qXI5ByIPNLyFio0ZdYW9b4IWoFXTltdb/yKCC10Crscj5J4hg==", "dev": true, "dependencies": { - "data-structure-typed": "^1.51.0" + "data-structure-typed": "^1.51.2" } }, "node_modules/brace-expansion": { @@ -3390,12 +3390,12 @@ } }, "node_modules/bst-typed": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.51.1.tgz", - "integrity": "sha512-oSwds4Lmj/kEGxr1E2l+3uWocDNtLCtGb418+jhXNhqQ8qAnC+LJPVdG/hvdkt7t8V39BiI2uFGh0kYAD8ar1Q==", + "version": "1.51.2", + "resolved": "https://registry.npmjs.org/bst-typed/-/bst-typed-1.51.2.tgz", + "integrity": "sha512-HZAin1lXSA3wdbzbsx654O+b98rS1ZDKk4eyoFF11n5x09hhCMeMpq8RbNudqf4T8/O6iCipeRJHrlhvYjILoQ==", "dev": true, "dependencies": { - "data-structure-typed": "^1.51.0" + "data-structure-typed": "^1.51.2" } }, "node_modules/buffer-from": { @@ -3838,9 +3838,9 @@ } }, "node_modules/data-structure-typed": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.51.1.tgz", - "integrity": "sha512-NEV6e+PiaSleg9hFhy+AULzhHmnLtynM1df1N/FPJtnT1r5apX+BW2E+nwfkMoujo9f3wW00BoAnC4qTGoaoOQ==", + "version": "1.51.2", + "resolved": "https://registry.npmjs.org/data-structure-typed/-/data-structure-typed-1.51.2.tgz", + "integrity": "sha512-SsHwBgy/X3xHb8Myj9S5fReO21tEyqK0IVho9HBdhtbIrf5qqnMH+LPOxnS6iAAomrSu50yiSLytpPaecbOXhA==", "dev": true }, "node_modules/debug": { @@ -5363,12 +5363,12 @@ } }, "node_modules/heap-typed": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.51.1.tgz", - "integrity": "sha512-tvcPaEKA356gXr2OiFnCZTgelR+3bBZBQ3Ua3bvBgw4E2UeyQIvSqTJw7YE9NaoYBwTuqXMGKTqAcCoyxU7NkA==", + "version": "1.51.2", + "resolved": "https://registry.npmjs.org/heap-typed/-/heap-typed-1.51.2.tgz", + "integrity": "sha512-bHoMxZ2nhDmgX4H1VYEBRCfTnO2VjU3TFU4UbR9vfnhWAVIKdnf617j0n6p8o9leA32cozsy49YEmSvW2qFAZg==", "dev": true, "dependencies": { - "data-structure-typed": "^1.51.0" + "data-structure-typed": "^1.51.2" } }, "node_modules/html-escaper": { diff --git a/package.json b/package.json index bb682e5..946e499 100644 --- a/package.json +++ b/package.json @@ -66,11 +66,11 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "auto-changelog": "^2.4.0", - "avl-tree-typed": "^1.51.1", + "avl-tree-typed": "^1.51.2", "benchmark": "^2.1.4", - "binary-tree-typed": "^1.51.1", - "bst-typed": "^1.51.1", - "data-structure-typed": "^1.51.1", + "binary-tree-typed": "^1.51.2", + "bst-typed": "^1.51.2", + "data-structure-typed": "^1.51.2", "dependency-cruiser": "^14.1.0", "doctoc": "^2.2.1", "eslint": "^8.50.0", @@ -79,7 +79,7 @@ "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", "fast-glob": "^3.3.1", - "heap-typed": "^1.51.1", + "heap-typed": "^1.51.2", "istanbul-badges-readme": "^1.8.5", "jest": "^29.7.0", "js-sdsl": "^4.4.2",