data-structure-typed 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.github/workflows/ci.yml +7 -2
  2. package/.github/workflows/release-package.yml +9 -2
  3. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +108 -108
  4. package/docs-site-docusaurus/docs/api/classes/BST.md +101 -101
  5. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +13 -13
  6. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +66 -66
  7. package/docs-site-docusaurus/docs/api/classes/Deque.md +235 -51
  8. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +21 -21
  9. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +231 -67
  10. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
  11. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
  12. package/docs-site-docusaurus/docs/api/classes/HashMap.md +14 -14
  13. package/docs-site-docusaurus/docs/api/classes/Heap.md +117 -34
  14. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +83 -13
  15. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +124 -20
  16. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +140 -32
  17. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +23 -23
  18. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +159 -51
  19. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +20 -20
  20. package/docs-site-docusaurus/docs/api/classes/Matrix.md +23 -23
  21. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +117 -34
  22. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +117 -34
  23. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +117 -34
  24. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +117 -34
  25. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +117 -34
  26. package/docs-site-docusaurus/docs/api/classes/Queue.md +142 -34
  27. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +117 -117
  28. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +8 -8
  29. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +158 -50
  30. package/docs-site-docusaurus/docs/api/classes/SkipList.md +21 -21
  31. package/docs-site-docusaurus/docs/api/classes/Stack.md +108 -26
  32. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +33 -33
  33. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +75 -39
  34. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +301 -39
  35. package/docs-site-docusaurus/docs/api/classes/Trie.md +110 -28
  36. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +20 -20
  37. package/package.json +45 -46
  38. package/src/common/error.ts +15 -32
  39. package/src/common/index.ts +0 -3
  40. package/src/data-structures/base/iterable-element-base.ts +0 -3
  41. package/src/data-structures/base/linear-base.ts +2 -36
  42. package/src/data-structures/binary-tree/avl-tree.ts +31 -529
  43. package/src/data-structures/binary-tree/binary-indexed-tree.ts +47 -572
  44. package/src/data-structures/binary-tree/binary-tree.ts +326 -1311
  45. package/src/data-structures/binary-tree/bst.ts +158 -1082
  46. package/src/data-structures/binary-tree/red-black-tree.ts +451 -1290
  47. package/src/data-structures/binary-tree/segment-tree.ts +73 -351
  48. package/src/data-structures/binary-tree/tree-map.ts +462 -5124
  49. package/src/data-structures/binary-tree/tree-multi-map.ts +302 -4914
  50. package/src/data-structures/binary-tree/tree-multi-set.ts +284 -3972
  51. package/src/data-structures/binary-tree/tree-set.ts +338 -4836
  52. package/src/data-structures/graph/abstract-graph.ts +98 -167
  53. package/src/data-structures/graph/directed-graph.ts +137 -562
  54. package/src/data-structures/graph/map-graph.ts +0 -3
  55. package/src/data-structures/graph/undirected-graph.ts +132 -511
  56. package/src/data-structures/hash/hash-map.ts +154 -582
  57. package/src/data-structures/heap/heap.ts +200 -795
  58. package/src/data-structures/linked-list/doubly-linked-list.ts +121 -865
  59. package/src/data-structures/linked-list/singly-linked-list.ts +122 -794
  60. package/src/data-structures/linked-list/skip-linked-list.ts +211 -918
  61. package/src/data-structures/matrix/matrix.ts +179 -518
  62. package/src/data-structures/matrix/navigator.ts +0 -1
  63. package/src/data-structures/priority-queue/max-priority-queue.ts +1 -6
  64. package/src/data-structures/priority-queue/min-priority-queue.ts +6 -11
  65. package/src/data-structures/priority-queue/priority-queue.ts +1 -2
  66. package/src/data-structures/queue/deque.ts +214 -882
  67. package/src/data-structures/queue/queue.ts +102 -625
  68. package/src/data-structures/stack/stack.ts +76 -505
  69. package/src/data-structures/trie/trie.ts +98 -628
  70. package/src/types/common.ts +0 -10
  71. package/src/types/data-structures/binary-tree/bst.ts +0 -7
  72. package/src/types/data-structures/binary-tree/red-black-tree.ts +0 -1
  73. package/src/types/data-structures/graph/abstract-graph.ts +0 -2
  74. package/src/types/data-structures/hash/hash-map.ts +0 -3
  75. package/src/types/data-structures/hash/index.ts +0 -1
  76. package/src/types/data-structures/matrix/navigator.ts +0 -2
  77. package/src/types/utils/utils.ts +0 -7
  78. package/src/types/utils/validate-type.ts +0 -7
  79. package/src/utils/number.ts +0 -2
  80. package/src/utils/utils.ts +0 -5
@@ -116,7 +116,6 @@ export class Navigator<T = number> {
116
116
  this._cur[1]--;
117
117
  break;
118
118
  }
119
-
120
119
  const [i, j] = this._cur;
121
120
  this._matrix[i][j] = this._VISITED;
122
121
  if (this.onMove) this.onMove(this._cur);
@@ -67,12 +67,7 @@ import { ERR, raise } from '../../common';
67
67
  * while (cpuQueue.size > 0) {
68
68
  * order.push(cpuQueue.poll()![1]);
69
69
  * }
70
- * console.log(order); // [
71
- * // 'User interaction',
72
- * // 'System process',
73
- * // 'Network sync',
74
- * // 'Background task'
75
- * // ];
70
+ * console.log(order); // ['User interaction', 'System process', 'Network sync', 'Background task'];
76
71
  */
77
72
  export class MaxPriorityQueue<E = any, R = any> extends PriorityQueue<E, R> {
78
73
  /**
@@ -18,10 +18,10 @@ import { PriorityQueue } from './priority-queue';
18
18
  * // Shortest job first scheduling
19
19
  * const jobs = new MinPriorityQueue<number>();
20
20
  *
21
- * jobs.add(8); // 8 seconds
22
- * jobs.add(2); // 2 seconds
23
- * jobs.add(5); // 5 seconds
24
- * jobs.add(1); // 1 second
21
+ * jobs.add(8); // 8 seconds
22
+ * jobs.add(2); // 2 seconds
23
+ * jobs.add(5); // 5 seconds
24
+ * jobs.add(1); // 1 second
25
25
  *
26
26
  * // Shortest job first
27
27
  * console.log(jobs.poll()); // 1;
@@ -48,12 +48,7 @@ import { PriorityQueue } from './priority-queue';
48
48
  * while (timeline.size > 0) {
49
49
  * order.push(timeline.poll()!.action);
50
50
  * }
51
- * console.log(order); // [
52
- * // 'Request received',
53
- * // 'Cache hit',
54
- * // 'Processing done',
55
- * // 'Timeout'
56
- * // ];
51
+ * console.log(order); // ['Request received', 'Cache hit', 'Processing done', 'Timeout'];
57
52
  * @example
58
53
  * // Huffman coding frequency selection
59
54
  * // Character frequencies for Huffman tree building
@@ -69,7 +64,7 @@ import { PriorityQueue } from './priority-queue';
69
64
  * // Always pick two lowest frequencies
70
65
  * const first = freq.poll()!;
71
66
  * const second = freq.poll()!;
72
- * console.log(first[1]); // 'd'; // freq 2
67
+ * console.log(first[1]); // 'd'; // freq 2
73
68
  * console.log(second[1]); // 'a'; // freq 5
74
69
  *
75
70
  * // Combined node goes back
@@ -5,7 +5,6 @@
5
5
  * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
6
6
  * @license MIT License
7
7
  */
8
-
9
8
  import type { PriorityQueueOptions } from '../../types';
10
9
  import { Heap } from '../heap';
11
10
 
@@ -62,7 +61,7 @@ import { Heap } from '../heap';
62
61
  * comparator: (a, b) => a[0] - b[0]
63
62
  * });
64
63
  *
65
- * bandwidth.add([1, 'Video call']); // highest priority
64
+ * bandwidth.add([1, 'Video call']); // highest priority
66
65
  * bandwidth.add([3, 'File download']);
67
66
  * bandwidth.add([2, 'Web browsing']);
68
67
  * bandwidth.add([1, 'Voice call']);