From f15792c529f48d2e0667e1e63405dca8bd9cd5c8 Mon Sep 17 00:00:00 2001 From: Revone Date: Mon, 6 Nov 2023 11:01:32 +0800 Subject: [PATCH] [project] tables optimization of README.md --- README.md | 41 ++++++++++++++++++++++++----------------- package.json | 2 +- test/utils/json2html.ts | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ecb4183..0b3571b 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,13 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D +Red Black Tree + + +AVLTree + + + Tree Multiset @@ -288,7 +295,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D Segment Tree - + SegmentTree @@ -366,20 +373,20 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D Stack - + Stack Coordinate Set - + CoordinateSet Coordinate Map - + CoordinateMap @@ -415,7 +422,7 @@ Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.id) // ['A', 'B', 'D Trie - + Trie @@ -629,40 +636,40 @@ optimal approach to data structure design. [//]: # (Start of Replace Section)
avl-tree
-
test nametime taken (ms)executions per secsample deviation
10,000 add randomly30.1833.132.75e-4
10,000 add & delete randomly65.6515.230.00
10,000 addMany39.5625.283.25e-4
10,000 get26.5737.631.92e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 add randomly30.6532.633.52e-4
10,000 add & delete randomly66.8414.960.00
10,000 addMany41.5224.080.01
10,000 get26.8537.244.74e-4
binary-tree
-
test nametime taken (ms)executions per secsample deviation
1,000 add randomly13.0076.933.84e-4
1,000 add & delete randomly16.1162.063.76e-4
1,000 addMany10.6394.041.30e-4
1,000 get18.2454.845.04e-4
1,000 dfs69.7714.334.07e-4
1,000 bfs54.4918.354.96e-4
1,000 morris37.1026.962.35e-4
+
test nametime taken (ms)executions per secsample deviation
1,000 add randomly12.9976.993.06e-4
1,000 add & delete randomly16.1262.044.54e-4
1,000 addMany10.9591.298.27e-4
1,000 get18.1055.242.56e-4
1,000 dfs69.3314.426.64e-4
1,000 bfs57.0417.534.09e-4
1,000 morris37.1426.933.56e-4
bst
-
test nametime taken (ms)executions per secsample deviation
10,000 add randomly31.8831.373.10e-4
10,000 add & delete randomly73.0813.680.01
10,000 addMany28.8034.730.00
10,000 get27.5936.252.19e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 add randomly29.6033.793.76e-4
10,000 add & delete randomly67.4514.830.00
10,000 addMany29.0934.388.10e-4
10,000 get27.8135.968.19e-4
rb-tree
-
test nametime taken (ms)executions per secsample deviation
100,000 add randomly70.9714.090.00
100,000 add & 1000 delete randomly82.0312.190.01
100,000 getNode59.7516.740.00
+
test nametime taken (ms)executions per secsample deviation
100,000 add randomly73.4613.610.01
100,000 add & 1000 delete randomly81.3512.290.01
100,000 getNode65.2315.330.01
directed-graph
-
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.109894.621.57e-6
1,000 addEdge6.17162.150.00
1,000 getVertex0.052.17e+44.06e-7
1,000 getEdge23.5042.560.00
tarjan223.184.480.01
tarjan all226.104.420.01
topologicalSort186.205.370.02
+
test nametime taken (ms)executions per secsample deviation
1,000 addVertex0.109826.704.27e-6
1,000 addEdge6.37156.883.98e-4
1,000 getVertex0.052.14e+49.10e-7
1,000 getEdge22.9343.620.00
tarjan213.014.690.01
tarjan all213.984.670.00
topologicalSort174.065.740.01
heap
-
test nametime taken (ms)executions per secsample deviation
10,000 add & pop4.64215.304.51e-5
10,000 fib add & pop351.832.840.00
+
test nametime taken (ms)executions per secsample deviation
10,000 add & pop4.65214.971.07e-4
10,000 fib add & pop354.242.820.00
doubly-linked-list
-
test nametime taken (ms)executions per secsample deviation
1,000,000 unshift216.194.630.04
1,000,000 unshift & shift164.846.070.02
1,000,000 insertBefore325.143.080.07
+
test nametime taken (ms)executions per secsample deviation
1,000,000 unshift226.924.410.05
1,000,000 unshift & shift169.365.900.04
1,000,000 insertBefore319.443.130.06
singly-linked-list
-
test nametime taken (ms)executions per secsample deviation
10,000 push & pop213.244.690.01
10,000 insertBefore247.694.040.01
+
test nametime taken (ms)executions per secsample deviation
10,000 push & pop226.294.420.02
10,000 insertBefore252.653.960.01
max-priority-queue
-
test nametime taken (ms)executions per secsample deviation
10,000 refill & poll11.5086.971.99e-4
+
test nametime taken (ms)executions per secsample deviation
10,000 refill & poll11.6485.912.88e-4
deque
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push223.304.480.08
1,000,000 shift24.8640.230.00
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push222.814.490.06
1,000,000 shift26.8037.310.00
queue
-
test nametime taken (ms)executions per secsample deviation
1,000,000 push42.2623.660.01
1,000,000 push & shift79.2212.620.00
+
test nametime taken (ms)executions per secsample deviation
1,000,000 push45.9021.790.01
1,000,000 push & shift81.2412.310.00
trie
-
test nametime taken (ms)executions per secsample deviation
100,000 push52.9218.900.00
100,000 getWords83.3711.990.00
+
test nametime taken (ms)executions per secsample deviation
100,000 push59.0316.940.01
100,000 getWords89.1711.210.00
[//]: # (End of Replace Section) \ No newline at end of file diff --git a/package.json b/package.json index e159553..4690f56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "data-structure-typed", - "version": "1.42.0", + "version": "1.42.1", "description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.", "main": "dist/cjs/src/index.js", "module": "dist/mjs/src/index.js", diff --git a/test/utils/json2html.ts b/test/utils/json2html.ts index 55f6504..8eefe33 100644 --- a/test/utils/json2html.ts +++ b/test/utils/json2html.ts @@ -109,7 +109,7 @@ function drawTable(arr: any[]): string { const content = arr.map(rowObj => drawRow(cols, rowObj)); const headingHtml = '' + cols.join('') + ''; const contentHtml = '' + content.join('') + ''; - return '' + headingHtml + contentHtml + '
'; + return '' + headingHtml + contentHtml + '
'; } function _render(name: string, data: any, options: Json2htmlOptions, level: number, altRow: number): string {