data-structure-typed 0.9.16 → 1.3.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 (264) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +665 -172
  3. package/dist/bundle.js +2 -0
  4. package/dist/bundle.js.LICENSE.txt +13 -0
  5. package/dist/data-structures/binary-tree/aa-tree.js +2 -5
  6. package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +364 -0
  7. package/dist/data-structures/binary-tree/abstract-binary-tree.js +1308 -0
  8. package/dist/data-structures/binary-tree/avl-tree.d.ts +85 -14
  9. package/dist/data-structures/binary-tree/avl-tree.js +142 -116
  10. package/dist/data-structures/binary-tree/b-tree.js +2 -5
  11. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +39 -1
  12. package/dist/data-structures/binary-tree/binary-indexed-tree.js +54 -13
  13. package/dist/data-structures/binary-tree/binary-tree.d.ts +29 -126
  14. package/dist/data-structures/binary-tree/binary-tree.js +31 -1093
  15. package/dist/data-structures/binary-tree/bst.d.ts +117 -23
  16. package/dist/data-structures/binary-tree/bst.js +233 -240
  17. package/dist/data-structures/binary-tree/index.d.ts +1 -0
  18. package/dist/data-structures/binary-tree/index.js +1 -0
  19. package/dist/data-structures/binary-tree/rb-tree.d.ts +18 -1
  20. package/dist/data-structures/binary-tree/rb-tree.js +40 -5
  21. package/dist/data-structures/binary-tree/segment-tree.d.ts +61 -11
  22. package/dist/data-structures/binary-tree/segment-tree.js +126 -93
  23. package/dist/data-structures/binary-tree/splay-tree.js +2 -5
  24. package/dist/data-structures/binary-tree/tree-multiset.d.ts +213 -6
  25. package/dist/data-structures/binary-tree/tree-multiset.js +687 -34
  26. package/dist/data-structures/binary-tree/two-three-tree.js +2 -5
  27. package/dist/data-structures/graph/abstract-graph.d.ts +270 -36
  28. package/dist/data-structures/graph/abstract-graph.js +610 -572
  29. package/dist/data-structures/graph/directed-graph.d.ts +173 -16
  30. package/dist/data-structures/graph/directed-graph.js +345 -313
  31. package/dist/data-structures/graph/index.d.ts +1 -0
  32. package/dist/data-structures/graph/index.js +1 -0
  33. package/dist/data-structures/graph/map-graph.d.ts +79 -0
  34. package/dist/data-structures/graph/map-graph.js +111 -0
  35. package/dist/data-structures/graph/undirected-graph.d.ts +111 -9
  36. package/dist/data-structures/graph/undirected-graph.js +203 -178
  37. package/dist/data-structures/hash/coordinate-map.d.ts +38 -1
  38. package/dist/data-structures/hash/coordinate-map.js +59 -36
  39. package/dist/data-structures/hash/coordinate-set.d.ts +32 -2
  40. package/dist/data-structures/hash/coordinate-set.js +49 -33
  41. package/dist/data-structures/hash/hash-table.d.ts +2 -1
  42. package/dist/data-structures/hash/hash-table.js +4 -0
  43. package/dist/data-structures/hash/pair.d.ts +2 -1
  44. package/dist/data-structures/hash/pair.js +4 -0
  45. package/dist/data-structures/hash/tree-map.d.ts +2 -1
  46. package/dist/data-structures/hash/tree-map.js +4 -0
  47. package/dist/data-structures/hash/tree-set.d.ts +2 -1
  48. package/dist/data-structures/hash/tree-set.js +4 -0
  49. package/dist/data-structures/heap/heap.d.ts +62 -45
  50. package/dist/data-structures/heap/heap.js +124 -86
  51. package/dist/data-structures/heap/max-heap.d.ts +13 -5
  52. package/dist/data-structures/heap/max-heap.js +18 -28
  53. package/dist/data-structures/heap/min-heap.d.ts +14 -5
  54. package/dist/data-structures/heap/min-heap.js +19 -28
  55. package/dist/data-structures/index.d.ts +1 -1
  56. package/dist/data-structures/index.js +1 -1
  57. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +193 -56
  58. package/dist/data-structures/linked-list/doubly-linked-list.js +484 -220
  59. package/dist/data-structures/linked-list/index.d.ts +1 -0
  60. package/dist/data-structures/linked-list/index.js +1 -0
  61. package/dist/data-structures/linked-list/singly-linked-list.d.ts +117 -315
  62. package/dist/data-structures/linked-list/singly-linked-list.js +374 -727
  63. package/dist/data-structures/linked-list/skip-linked-list.d.ts +2 -1
  64. package/dist/data-structures/linked-list/skip-linked-list.js +4 -0
  65. package/dist/data-structures/matrix/matrix.d.ts +12 -0
  66. package/dist/data-structures/matrix/matrix.js +21 -8
  67. package/dist/data-structures/matrix/matrix2d.d.ts +85 -2
  68. package/dist/data-structures/matrix/matrix2d.js +146 -80
  69. package/dist/data-structures/matrix/navigator.d.ts +36 -1
  70. package/dist/data-structures/matrix/navigator.js +46 -37
  71. package/dist/data-structures/matrix/vector2d.d.ts +142 -15
  72. package/dist/data-structures/matrix/vector2d.js +215 -109
  73. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +12 -2
  74. package/dist/data-structures/priority-queue/max-priority-queue.js +33 -26
  75. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +12 -2
  76. package/dist/data-structures/priority-queue/min-priority-queue.js +34 -26
  77. package/dist/data-structures/priority-queue/priority-queue.d.ts +153 -3
  78. package/dist/data-structures/priority-queue/priority-queue.js +244 -143
  79. package/dist/data-structures/queue/deque.d.ts +141 -13
  80. package/dist/data-structures/queue/deque.js +200 -82
  81. package/dist/data-structures/queue/queue.d.ts +65 -38
  82. package/dist/data-structures/queue/queue.js +110 -66
  83. package/dist/data-structures/stack/stack.d.ts +27 -32
  84. package/dist/data-structures/stack/stack.js +47 -53
  85. package/dist/data-structures/tree/index.d.ts +1 -0
  86. package/dist/data-structures/tree/index.js +17 -0
  87. package/dist/data-structures/tree/tree.d.ts +14 -0
  88. package/dist/data-structures/tree/tree.js +60 -0
  89. package/dist/data-structures/trie/trie.d.ts +33 -10
  90. package/dist/data-structures/trie/trie.js +123 -208
  91. package/dist/index.d.ts +3 -0
  92. package/dist/index.js +3 -0
  93. package/dist/interfaces/abstract-binary-tree.d.ts +90 -0
  94. package/dist/interfaces/abstract-graph.d.ts +17 -0
  95. package/dist/interfaces/avl-tree.d.ts +9 -0
  96. package/dist/interfaces/binary-tree.d.ts +6 -0
  97. package/dist/interfaces/bst.d.ts +17 -0
  98. package/dist/interfaces/directed-graph.d.ts +12 -0
  99. package/{src/data-structures/types/index.ts → dist/interfaces/index.d.ts} +10 -8
  100. package/dist/interfaces/index.js +31 -0
  101. package/{src/data-structures/hash/hash-table.ts → dist/interfaces/priority-queue.d.ts} +1 -1
  102. package/dist/interfaces/rb-tree.d.ts +8 -0
  103. package/dist/interfaces/segment-tree.d.ts +1 -0
  104. package/dist/interfaces/singly-linked-list.d.ts +1 -0
  105. package/dist/interfaces/singly-linked-list.js +2 -0
  106. package/dist/interfaces/tree-multiset.d.ts +7 -0
  107. package/dist/interfaces/tree-multiset.js +2 -0
  108. package/dist/interfaces/undirected-graph.d.ts +5 -0
  109. package/dist/interfaces/undirected-graph.js +2 -0
  110. package/dist/types/data-structures/abstract-binary-tree.d.ts +34 -0
  111. package/dist/types/data-structures/abstract-binary-tree.js +25 -0
  112. package/dist/types/data-structures/abstract-graph.d.ts +11 -0
  113. package/dist/types/data-structures/abstract-graph.js +2 -0
  114. package/dist/types/data-structures/avl-tree.d.ts +4 -0
  115. package/dist/types/data-structures/avl-tree.js +2 -0
  116. package/dist/types/data-structures/binary-tree.d.ts +4 -0
  117. package/dist/types/data-structures/binary-tree.js +2 -0
  118. package/dist/types/data-structures/bst.d.ts +13 -0
  119. package/dist/types/data-structures/bst.js +9 -0
  120. package/dist/types/data-structures/directed-graph.d.ts +6 -0
  121. package/dist/types/data-structures/directed-graph.js +9 -0
  122. package/dist/types/data-structures/doubly-linked-list.d.ts +1 -0
  123. package/dist/types/data-structures/doubly-linked-list.js +2 -0
  124. package/dist/types/data-structures/heap.d.ts +3 -0
  125. package/dist/types/data-structures/heap.js +2 -0
  126. package/dist/{data-structures/types → types/data-structures}/index.d.ts +3 -1
  127. package/dist/{data-structures/types → types/data-structures}/index.js +3 -1
  128. package/dist/types/data-structures/map-graph.d.ts +1 -0
  129. package/dist/types/data-structures/map-graph.js +2 -0
  130. package/dist/{data-structures/types → types/data-structures}/navigator.d.ts +2 -2
  131. package/dist/types/data-structures/navigator.js +2 -0
  132. package/dist/{data-structures/types → types/data-structures}/priority-queue.d.ts +2 -2
  133. package/dist/types/data-structures/priority-queue.js +2 -0
  134. package/dist/types/data-structures/rb-tree.d.ts +8 -0
  135. package/dist/types/data-structures/rb-tree.js +8 -0
  136. package/dist/types/data-structures/segment-tree.js +2 -0
  137. package/dist/types/data-structures/singly-linked-list.d.ts +1 -0
  138. package/dist/types/data-structures/singly-linked-list.js +2 -0
  139. package/dist/types/data-structures/tree-multiset.d.ts +4 -0
  140. package/dist/types/data-structures/tree-multiset.js +2 -0
  141. package/dist/types/helpers.d.ts +1 -0
  142. package/dist/types/helpers.js +2 -0
  143. package/dist/types/index.d.ts +3 -0
  144. package/dist/types/index.js +19 -0
  145. package/dist/types/utils/index.d.ts +2 -0
  146. package/dist/types/utils/index.js +18 -0
  147. package/dist/types/utils/utils.d.ts +7 -0
  148. package/dist/types/utils/utils.js +2 -0
  149. package/dist/types/utils/validate-type.d.ts +19 -0
  150. package/dist/types/utils/validate-type.js +2 -0
  151. package/dist/utils/utils.d.ts +17 -103
  152. package/dist/utils/utils.js +40 -625
  153. package/package.json +134 -23
  154. package/.idea/data-structure-typed.iml +0 -12
  155. package/.idea/modules.xml +0 -8
  156. package/.idea/vcs.xml +0 -6
  157. package/dist/data-structures/trampoline.d.ts +0 -16
  158. package/dist/data-structures/trampoline.js +0 -130
  159. package/dist/data-structures/types/abstract-graph.d.ts +0 -29
  160. package/dist/data-structures/types/avl-tree.d.ts +0 -5
  161. package/dist/data-structures/types/binary-tree.d.ts +0 -16
  162. package/dist/data-structures/types/bst.d.ts +0 -7
  163. package/dist/data-structures/types/directed-graph.d.ts +0 -10
  164. package/dist/data-structures/types/doubly-linked-list.d.ts +0 -1
  165. package/dist/data-structures/types/heap.d.ts +0 -7
  166. package/dist/data-structures/types/singly-linked-list.d.ts +0 -5
  167. package/dist/data-structures/types/tree-multiset.d.ts +0 -5
  168. package/dist/data-structures/types/utils.d.ts +0 -52
  169. package/dist/data-structures/types/utils.js +0 -54
  170. package/src/data-structures/binary-tree/aa-tree.ts +0 -3
  171. package/src/data-structures/binary-tree/avl-tree.ts +0 -227
  172. package/src/data-structures/binary-tree/b-tree.ts +0 -3
  173. package/src/data-structures/binary-tree/binary-indexed-tree.ts +0 -33
  174. package/src/data-structures/binary-tree/binary-tree.ts +0 -1133
  175. package/src/data-structures/binary-tree/bst.ts +0 -395
  176. package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
  177. package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
  178. package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
  179. package/src/data-structures/binary-tree/index.ts +0 -11
  180. package/src/data-structures/binary-tree/rb-tree.ts +0 -3
  181. package/src/data-structures/binary-tree/segment-tree.ts +0 -172
  182. package/src/data-structures/binary-tree/splay-tree.ts +0 -3
  183. package/src/data-structures/binary-tree/tree-multiset.ts +0 -18
  184. package/src/data-structures/binary-tree/two-three-tree.ts +0 -3
  185. package/src/data-structures/diagrams/README.md +0 -7
  186. package/src/data-structures/graph/abstract-graph.ts +0 -753
  187. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.png +0 -0
  188. package/src/data-structures/graph/diagrams/adjacency-list.png +0 -0
  189. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.png +0 -0
  190. package/src/data-structures/graph/diagrams/adjacency-matrix.png +0 -0
  191. package/src/data-structures/graph/diagrams/dfs-can-do.png +0 -0
  192. package/src/data-structures/graph/diagrams/edge-list-pros-cons.png +0 -0
  193. package/src/data-structures/graph/diagrams/edge-list.png +0 -0
  194. package/src/data-structures/graph/diagrams/max-flow.png +0 -0
  195. package/src/data-structures/graph/diagrams/mst.png +0 -0
  196. package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
  197. package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
  198. package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
  199. package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
  200. package/src/data-structures/graph/directed-graph.ts +0 -306
  201. package/src/data-structures/graph/index.ts +0 -3
  202. package/src/data-structures/graph/undirected-graph.ts +0 -155
  203. package/src/data-structures/hash/coordinate-map.ts +0 -24
  204. package/src/data-structures/hash/coordinate-set.ts +0 -20
  205. package/src/data-structures/hash/index.ts +0 -6
  206. package/src/data-structures/heap/heap.ts +0 -127
  207. package/src/data-structures/heap/index.ts +0 -3
  208. package/src/data-structures/heap/max-heap.ts +0 -23
  209. package/src/data-structures/heap/min-heap.ts +0 -25
  210. package/src/data-structures/index.ts +0 -12
  211. package/src/data-structures/linked-list/doubly-linked-list.ts +0 -250
  212. package/src/data-structures/linked-list/index.ts +0 -2
  213. package/src/data-structures/linked-list/singly-linked-list.ts +0 -736
  214. package/src/data-structures/linked-list/skip-linked-list.ts +0 -1
  215. package/src/data-structures/matrix/index.ts +0 -4
  216. package/src/data-structures/matrix/matrix.ts +0 -13
  217. package/src/data-structures/matrix/matrix2d.ts +0 -125
  218. package/src/data-structures/matrix/navigator.ts +0 -87
  219. package/src/data-structures/matrix/vector2d.ts +0 -189
  220. package/src/data-structures/priority-queue/index.ts +0 -3
  221. package/src/data-structures/priority-queue/max-priority-queue.ts +0 -13
  222. package/src/data-structures/priority-queue/min-priority-queue.ts +0 -13
  223. package/src/data-structures/priority-queue/priority-queue.ts +0 -200
  224. package/src/data-structures/queue/deque.ts +0 -139
  225. package/src/data-structures/queue/index.ts +0 -2
  226. package/src/data-structures/queue/queue.ts +0 -122
  227. package/src/data-structures/stack/index.ts +0 -1
  228. package/src/data-structures/stack/stack.ts +0 -103
  229. package/src/data-structures/trampoline.ts +0 -51
  230. package/src/data-structures/trie/index.ts +0 -1
  231. package/src/data-structures/trie/trie.ts +0 -203
  232. package/src/data-structures/types/abstract-graph.ts +0 -51
  233. package/src/data-structures/types/avl-tree.ts +0 -6
  234. package/src/data-structures/types/binary-tree.ts +0 -15
  235. package/src/data-structures/types/bst.ts +0 -5
  236. package/src/data-structures/types/directed-graph.ts +0 -18
  237. package/src/data-structures/types/doubly-linked-list.ts +0 -1
  238. package/src/data-structures/types/heap.ts +0 -8
  239. package/src/data-structures/types/navigator.ts +0 -12
  240. package/src/data-structures/types/priority-queue.ts +0 -9
  241. package/src/data-structures/types/segment-tree.ts +0 -1
  242. package/src/data-structures/types/singly-linked-list.ts +0 -15
  243. package/src/data-structures/types/tree-multiset.ts +0 -3
  244. package/src/data-structures/types/utils.ts +0 -173
  245. package/src/index.ts +0 -1
  246. package/src/utils/index.ts +0 -1
  247. package/src/utils/utils.ts +0 -505
  248. package/tsconfig.json +0 -56
  249. /package/dist/{data-structures/types/abstract-graph.js → interfaces/abstract-binary-tree.js} +0 -0
  250. /package/dist/{data-structures/types/avl-tree.js → interfaces/abstract-graph.js} +0 -0
  251. /package/dist/{data-structures/types/binary-tree.js → interfaces/avl-tree.js} +0 -0
  252. /package/dist/{data-structures/types/bst.js → interfaces/binary-tree.js} +0 -0
  253. /package/dist/{data-structures/types/directed-graph.js → interfaces/bst.js} +0 -0
  254. /package/dist/{data-structures/types/doubly-linked-list.js → interfaces/directed-graph.js} +0 -0
  255. /package/{src/data-structures/hash/pair.ts → dist/interfaces/doubly-linked-list.d.ts} +0 -0
  256. /package/dist/{data-structures/types/heap.js → interfaces/doubly-linked-list.js} +0 -0
  257. /package/{src/data-structures/hash/tree-map.ts → dist/interfaces/heap.d.ts} +0 -0
  258. /package/dist/{data-structures/types/navigator.js → interfaces/heap.js} +0 -0
  259. /package/{src/data-structures/hash/tree-set.ts → dist/interfaces/navigator.d.ts} +0 -0
  260. /package/dist/{data-structures/types/priority-queue.js → interfaces/navigator.js} +0 -0
  261. /package/dist/{data-structures/types/segment-tree.js → interfaces/priority-queue.js} +0 -0
  262. /package/dist/{data-structures/types/singly-linked-list.js → interfaces/rb-tree.js} +0 -0
  263. /package/dist/{data-structures/types/tree-multiset.js → interfaces/segment-tree.js} +0 -0
  264. /package/dist/{data-structures/types → types/data-structures}/segment-tree.d.ts +0 -0
@@ -1,136 +1,82 @@
1
1
  "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.Trie = exports.TrieNode = void 0;
15
- var TrieNode = /** @class */ (function () {
16
- function TrieNode(v) {
17
- this._value = v;
4
+ /**
5
+ * data-structure-typed
6
+ *
7
+ * @author Tyler Zeng
8
+ * @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
9
+ * @license MIT License
10
+ */
11
+ class TrieNode {
12
+ constructor(v) {
13
+ this._val = v;
18
14
  this._isEnd = false;
19
15
  this._children = new Map();
20
16
  }
21
- Object.defineProperty(TrieNode.prototype, "children", {
22
- get: function () {
23
- return this._children;
24
- },
25
- set: function (v) {
26
- this._children = v;
27
- },
28
- enumerable: false,
29
- configurable: true
30
- });
31
- Object.defineProperty(TrieNode.prototype, "isEnd", {
32
- get: function () {
33
- return this._isEnd;
34
- },
35
- set: function (v) {
36
- this._isEnd = v;
37
- },
38
- enumerable: false,
39
- configurable: true
40
- });
41
- Object.defineProperty(TrieNode.prototype, "val", {
42
- get: function () {
43
- return this._value;
44
- },
45
- set: function (v) {
46
- this._value = v;
47
- },
48
- enumerable: false,
49
- configurable: true
50
- });
51
- return TrieNode;
52
- }());
17
+ get val() {
18
+ return this._val;
19
+ }
20
+ set val(v) {
21
+ this._val = v;
22
+ }
23
+ get children() {
24
+ return this._children;
25
+ }
26
+ set children(v) {
27
+ this._children = v;
28
+ }
29
+ get isEnd() {
30
+ return this._isEnd;
31
+ }
32
+ set isEnd(v) {
33
+ this._isEnd = v;
34
+ }
35
+ }
53
36
  exports.TrieNode = TrieNode;
54
- var Trie = /** @class */ (function () {
55
- function Trie(words) {
56
- var e_1, _a;
37
+ class Trie {
38
+ constructor(words) {
57
39
  this._root = new TrieNode('');
58
40
  if (words) {
59
- try {
60
- for (var words_1 = __values(words), words_1_1 = words_1.next(); !words_1_1.done; words_1_1 = words_1.next()) {
61
- var i = words_1_1.value;
62
- this.put(i);
63
- }
64
- }
65
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
66
- finally {
67
- try {
68
- if (words_1_1 && !words_1_1.done && (_a = words_1.return)) _a.call(words_1);
69
- }
70
- finally { if (e_1) throw e_1.error; }
41
+ for (const i of words) {
42
+ this.add(i);
71
43
  }
72
44
  }
73
45
  }
74
- Object.defineProperty(Trie.prototype, "root", {
75
- get: function () {
76
- return this._root;
77
- },
78
- set: function (v) {
79
- this._root = v;
80
- },
81
- enumerable: false,
82
- configurable: true
83
- });
84
- Trie.prototype.put = function (word) {
85
- var e_2, _a;
86
- var cur = this._root;
87
- try {
88
- for (var word_1 = __values(word), word_1_1 = word_1.next(); !word_1_1.done; word_1_1 = word_1.next()) {
89
- var c = word_1_1.value;
90
- var nodeC = cur.children.get(c);
91
- if (!nodeC) {
92
- nodeC = new TrieNode(c);
93
- cur.children.set(c, nodeC);
94
- }
95
- cur = nodeC;
96
- }
97
- }
98
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
99
- finally {
100
- try {
101
- if (word_1_1 && !word_1_1.done && (_a = word_1.return)) _a.call(word_1);
102
- }
103
- finally { if (e_2) throw e_2.error; }
46
+ get root() {
47
+ return this._root;
48
+ }
49
+ set root(v) {
50
+ this._root = v;
51
+ }
52
+ add(word) {
53
+ let cur = this._root;
54
+ for (const c of word) {
55
+ let nodeC = cur.children.get(c);
56
+ if (!nodeC) {
57
+ nodeC = new TrieNode(c);
58
+ cur.children.set(c, nodeC);
59
+ }
60
+ cur = nodeC;
104
61
  }
105
62
  cur.isEnd = true;
106
63
  return true;
107
- };
108
- Trie.prototype.has = function (input) {
109
- var e_3, _a;
110
- var cur = this._root;
111
- try {
112
- for (var input_1 = __values(input), input_1_1 = input_1.next(); !input_1_1.done; input_1_1 = input_1.next()) {
113
- var c = input_1_1.value;
114
- var nodeC = cur.children.get(c);
115
- if (!nodeC)
116
- return false;
117
- cur = nodeC;
118
- }
119
- }
120
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
121
- finally {
122
- try {
123
- if (input_1_1 && !input_1_1.done && (_a = input_1.return)) _a.call(input_1);
124
- }
125
- finally { if (e_3) throw e_3.error; }
64
+ }
65
+ has(input) {
66
+ let cur = this._root;
67
+ for (const c of input) {
68
+ const nodeC = cur.children.get(c);
69
+ if (!nodeC)
70
+ return false;
71
+ cur = nodeC;
126
72
  }
127
73
  return cur.isEnd;
128
- };
129
- Trie.prototype.remove = function (word) {
130
- var isDeleted = false;
131
- var dfs = function (cur, i) {
132
- var char = word[i];
133
- var child = cur.children.get(char);
74
+ }
75
+ remove(word) {
76
+ let isDeleted = false;
77
+ const dfs = (cur, i) => {
78
+ const char = word[i];
79
+ const child = cur.children.get(char);
134
80
  if (child) {
135
81
  if (i === word.length - 1) {
136
82
  if (child.isEnd) {
@@ -145,7 +91,7 @@ var Trie = /** @class */ (function () {
145
91
  }
146
92
  return false;
147
93
  }
148
- var res = dfs(child, i + 1);
94
+ const res = dfs(child, i + 1);
149
95
  if (res && !cur.isEnd && child.children.size === 0) {
150
96
  cur.children.delete(char);
151
97
  return true;
@@ -156,65 +102,47 @@ var Trie = /** @class */ (function () {
156
102
  };
157
103
  dfs(this.root, 0);
158
104
  return isDeleted;
159
- };
105
+ }
160
106
  // --- start additional methods ---
161
107
  /**
162
- * Only can present as a prefix, not a word
163
- * @param input
108
+ * The function checks if a given input string has an absolute prefix in a tree data structure.Only can present as a prefix, not a word
109
+ * @param {string} input - The input parameter is a string that represents the input value for the function.
110
+ * @returns a boolean value.
164
111
  */
165
- Trie.prototype.isAbsPrefix = function (input) {
166
- var e_4, _a;
167
- var cur = this._root;
168
- try {
169
- for (var input_2 = __values(input), input_2_1 = input_2.next(); !input_2_1.done; input_2_1 = input_2.next()) {
170
- var c = input_2_1.value;
171
- var nodeC = cur.children.get(c);
172
- if (!nodeC)
173
- return false;
174
- cur = nodeC;
175
- }
176
- }
177
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
178
- finally {
179
- try {
180
- if (input_2_1 && !input_2_1.done && (_a = input_2.return)) _a.call(input_2);
181
- }
182
- finally { if (e_4) throw e_4.error; }
112
+ isAbsPrefix(input) {
113
+ let cur = this._root;
114
+ for (const c of input) {
115
+ const nodeC = cur.children.get(c);
116
+ if (!nodeC)
117
+ return false;
118
+ cur = nodeC;
183
119
  }
184
120
  return !cur.isEnd;
185
- };
121
+ }
186
122
  /**
187
- * Can present as a abs prefix or word
188
- * @param input
123
+ * The function checks if a given input string is a prefix of any existing string in a tree structure.Can present as a abs prefix or word
124
+ * @param {string} input - The input parameter is a string that represents the prefix we want to check.
125
+ * @returns a boolean value.
189
126
  */
190
- Trie.prototype.isPrefix = function (input) {
191
- var e_5, _a;
192
- var cur = this._root;
193
- try {
194
- for (var input_3 = __values(input), input_3_1 = input_3.next(); !input_3_1.done; input_3_1 = input_3.next()) {
195
- var c = input_3_1.value;
196
- var nodeC = cur.children.get(c);
197
- if (!nodeC)
198
- return false;
199
- cur = nodeC;
200
- }
201
- }
202
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
203
- finally {
204
- try {
205
- if (input_3_1 && !input_3_1.done && (_a = input_3.return)) _a.call(input_3);
206
- }
207
- finally { if (e_5) throw e_5.error; }
127
+ isPrefix(input) {
128
+ let cur = this._root;
129
+ for (const c of input) {
130
+ const nodeC = cur.children.get(c);
131
+ if (!nodeC)
132
+ return false;
133
+ cur = nodeC;
208
134
  }
209
135
  return true;
210
- };
136
+ }
211
137
  /**
212
- * Check if the input string is the common prefix of all the words
213
- * @param input
138
+ * The function checks if the input string is a common prefix in a Trie data structure.Check if the input string is the common prefix of all the words
139
+ * @param {string} input - The input parameter is a string that represents the common prefix that we want to check for
140
+ * in the Trie data structure.
141
+ * @returns a boolean value indicating whether the input string is a common prefix in the Trie data structure.
214
142
  */
215
- Trie.prototype.isCommonPrefix = function (input) {
216
- var commonPre = '';
217
- var dfs = function (cur) {
143
+ isCommonPrefix(input) {
144
+ let commonPre = '';
145
+ const dfs = (cur) => {
218
146
  commonPre += cur.val;
219
147
  if (commonPre === input)
220
148
  return;
@@ -227,11 +155,16 @@ var Trie = /** @class */ (function () {
227
155
  };
228
156
  dfs(this._root);
229
157
  return commonPre === input;
230
- };
231
- // Retrieve the longest common prefix of all the words
232
- Trie.prototype.getLongestCommonPrefix = function () {
233
- var commonPre = '';
234
- var dfs = function (cur) {
158
+ }
159
+ /**
160
+ * The function `getLongestCommonPrefix` returns the longest common prefix among all the words stored in a Trie data
161
+ * structure.
162
+ * @returns The function `getLongestCommonPrefix` returns a string, which is the longest common prefix found in the
163
+ * Trie.
164
+ */
165
+ getLongestCommonPrefix() {
166
+ let commonPre = '';
167
+ const dfs = (cur) => {
235
168
  commonPre += cur.val;
236
169
  if (cur.isEnd)
237
170
  return;
@@ -242,54 +175,36 @@ var Trie = /** @class */ (function () {
242
175
  };
243
176
  dfs(this._root);
244
177
  return commonPre;
245
- };
246
- Trie.prototype.getAll = function (prefix) {
247
- var e_6, _a;
248
- if (prefix === void 0) { prefix = ''; }
249
- var words = [];
178
+ }
179
+ /**
180
+ * The `getAll` function returns an array of all words in a Trie data structure that start with a given prefix.
181
+ * @param [prefix] - The `prefix` parameter is a string that represents the prefix that we want to search for in the
182
+ * trie. It is an optional parameter, so if no prefix is provided, it will default to an empty string.
183
+ * @returns an array of strings.
184
+ */
185
+ getAll(prefix = '') {
186
+ const words = [];
250
187
  function dfs(node, word) {
251
- var e_7, _a;
252
- try {
253
- for (var _b = __values(node.children.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
254
- var char = _c.value;
255
- var charNode = node.children.get(char);
256
- if (charNode !== undefined) {
257
- dfs(charNode, word.concat(char));
258
- }
188
+ for (const char of node.children.keys()) {
189
+ const charNode = node.children.get(char);
190
+ if (charNode !== undefined) {
191
+ dfs(charNode, word.concat(char));
259
192
  }
260
193
  }
261
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
262
- finally {
263
- try {
264
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
265
- }
266
- finally { if (e_7) throw e_7.error; }
267
- }
268
194
  if (node.isEnd) {
269
195
  words.push(word);
270
196
  }
271
197
  }
272
- var startNode = this._root;
198
+ let startNode = this._root;
273
199
  if (prefix) {
274
- try {
275
- for (var prefix_1 = __values(prefix), prefix_1_1 = prefix_1.next(); !prefix_1_1.done; prefix_1_1 = prefix_1.next()) {
276
- var c = prefix_1_1.value;
277
- var nodeC = startNode.children.get(c);
278
- if (nodeC)
279
- startNode = nodeC;
280
- }
281
- }
282
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
283
- finally {
284
- try {
285
- if (prefix_1_1 && !prefix_1_1.done && (_a = prefix_1.return)) _a.call(prefix_1);
286
- }
287
- finally { if (e_6) throw e_6.error; }
200
+ for (const c of prefix) {
201
+ const nodeC = startNode.children.get(c);
202
+ if (nodeC)
203
+ startNode = nodeC;
288
204
  }
289
205
  }
290
206
  dfs(startNode, prefix);
291
207
  return words;
292
- };
293
- return Trie;
294
- }());
208
+ }
209
+ }
295
210
  exports.Trie = Trie;
package/dist/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export * from './data-structures';
2
+ export * from './utils';
3
+ export * from './interfaces';
4
+ export * from './types';
package/dist/index.js CHANGED
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./data-structures"), exports);
18
+ __exportStar(require("./utils"), exports);
19
+ __exportStar(require("./interfaces"), exports);
20
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,90 @@
1
+ import { AbstractBinaryTreeNodeProperties, AbstractBinaryTreeNodeProperty, BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName, DFSOrderPattern, FamilyPosition, LoopType, NodeOrPropertyName } from '../types';
2
+ import { AbstractBinaryTreeNode } from '../data-structures';
3
+ export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
4
+ get id(): BinaryTreeNodeId;
5
+ set id(v: BinaryTreeNodeId);
6
+ get val(): T | undefined;
7
+ set val(v: T | undefined);
8
+ get left(): NEIGHBOR | null | undefined;
9
+ set left(v: NEIGHBOR | null | undefined);
10
+ get right(): NEIGHBOR | null | undefined;
11
+ set right(v: NEIGHBOR | null | undefined);
12
+ get parent(): NEIGHBOR | null | undefined;
13
+ set parent(v: NEIGHBOR | null | undefined);
14
+ get familyPosition(): FamilyPosition;
15
+ get height(): number;
16
+ set height(v: number);
17
+ }
18
+ export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
19
+ createNode(id: BinaryTreeNodeId, val?: N['val'], count?: number): N | null;
20
+ get loopType(): LoopType;
21
+ get visitedId(): BinaryTreeNodeId[];
22
+ get visitedVal(): Array<N['val']>;
23
+ get visitedNode(): N[];
24
+ get visitedLeftSum(): number[];
25
+ get root(): N | null;
26
+ get size(): number;
27
+ swapLocation(srcNode: N, destNode: N): N;
28
+ clear(): void;
29
+ isEmpty(): boolean;
30
+ add(id: BinaryTreeNodeId | N, val?: N['val']): N | null | undefined;
31
+ addMany(idsOrNodes: (BinaryTreeNodeId | N | null)[], data?: N['val'][]): (N | null | undefined)[];
32
+ fill(idsOrNodes: (BinaryTreeNodeId | N | null)[], data?: N[] | Array<N['val']>): boolean;
33
+ remove(id: BinaryTreeNodeId, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
34
+ getDepth(node: N): number;
35
+ getHeight(beginRoot?: N | null): number;
36
+ getMinHeight(beginRoot?: N | null): number;
37
+ isPerfectlyBalanced(beginRoot?: N | null): boolean;
38
+ getNodes(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
39
+ has(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName): boolean;
40
+ get(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName): N | null;
41
+ getPathToRoot(node: N): N[];
42
+ getLeftMost(): N | null;
43
+ getLeftMost(node: N): N;
44
+ getLeftMost(node?: N | null): N | null;
45
+ getRightMost(): N | null;
46
+ getRightMost(node: N): N;
47
+ getRightMost(node?: N | null): N | null;
48
+ isSubtreeBST(node: N | null): boolean;
49
+ isBST(): boolean;
50
+ getSubTreeSize(subTreeRoot: N | null | undefined): number;
51
+ subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
52
+ subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
53
+ BFS(): BinaryTreeNodeId[];
54
+ BFS(nodeOrPropertyName: 'id'): BinaryTreeNodeId[];
55
+ BFS(nodeOrPropertyName: 'val'): N['val'][];
56
+ BFS(nodeOrPropertyName: 'node'): N[];
57
+ BFS(nodeOrPropertyName: 'count'): number[];
58
+ BFS(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
59
+ DFS(): BinaryTreeNodeId[];
60
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
61
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
62
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
63
+ DFS(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
64
+ DFS(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
65
+ DFSIterative(): BinaryTreeNodeId[];
66
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
67
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
68
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
69
+ DFSIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
70
+ DFSIterative(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
71
+ levelIterative(node: N | null): BinaryTreeNodeId[];
72
+ levelIterative(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
73
+ levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
74
+ levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
75
+ levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
76
+ levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
77
+ listLevels(node: N | null): BinaryTreeNodeId[][];
78
+ listLevels(node: N | null, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[][];
79
+ listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
80
+ listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
81
+ listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
82
+ listLevels(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperty<N>[][];
83
+ getPredecessor(node: N): N;
84
+ morris(): BinaryTreeNodeId[];
85
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'id'): BinaryTreeNodeId[];
86
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
87
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
88
+ morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
89
+ morris(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
90
+ }
@@ -0,0 +1,17 @@
1
+ import { VertexId } from '../types';
2
+ export interface IAbstractGraph<V, E> {
3
+ hasVertex(vertexOrId: V | VertexId): boolean;
4
+ addVertex(id: VertexId, val?: V): boolean;
5
+ removeVertex(vertexOrId: V | VertexId): boolean;
6
+ removeAllVertices(vertices: V[] | VertexId[]): boolean;
7
+ degreeOf(vertexOrId: V | VertexId): number;
8
+ edgesOf(vertexOrId: V | VertexId): E[];
9
+ hasEdge(src: V | VertexId, dest: V | VertexId): boolean;
10
+ getEdge(srcOrId: V | VertexId, destOrId: V | VertexId): E | null;
11
+ edgeSet(): E[];
12
+ addEdge(src: V | VertexId, dest: V | VertexId, weight: number, val: E): boolean;
13
+ removeEdge(edge: E): E | null;
14
+ setEdgeWeight(srcOrId: V | VertexId, destOrId: V | VertexId, weight: number): boolean;
15
+ getMinPathBetween(v1: V | VertexId, v2: V | VertexId, isWeight?: boolean): V[] | null;
16
+ getNeighbors(vertexOrId: V | VertexId): V[];
17
+ }
@@ -0,0 +1,9 @@
1
+ import { AVLTreeNode } from '../data-structures';
2
+ import { IBST, IBSTNode } from './bst';
3
+ import { BinaryTreeDeletedResult, BinaryTreeNodeId } from '../types';
4
+ export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
5
+ }
6
+ export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
7
+ add(id: BinaryTreeNodeId, val?: N['val'] | null): N | null | undefined;
8
+ remove(id: BinaryTreeNodeId, isUpdateAllLeftSum?: boolean): BinaryTreeDeletedResult<N>[];
9
+ }
@@ -0,0 +1,6 @@
1
+ import { BinaryTreeNode } from '../data-structures';
2
+ import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from './abstract-binary-tree';
3
+ export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> extends IAbstractBinaryTreeNode<T, NEIGHBOR> {
4
+ }
5
+ export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {
6
+ }
@@ -0,0 +1,17 @@
1
+ import { BSTNode } from '../data-structures';
2
+ import { IBinaryTree, IBinaryTreeNode } from './binary-tree';
3
+ import { BinaryTreeDeletedResult, BinaryTreeNodeId, BinaryTreeNodePropertyName } from '../types';
4
+ export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {
5
+ }
6
+ export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
7
+ createNode(id: BinaryTreeNodeId, val?: N['val'], count?: number): N;
8
+ add(id: BinaryTreeNodeId, val?: N['val'] | null, count?: number): N | null | undefined;
9
+ get(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName): N | null;
10
+ lastKey(): BinaryTreeNodeId;
11
+ remove(id: BinaryTreeNodeId, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
12
+ getNodes(nodeProperty: BinaryTreeNodeId | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
13
+ lesserSum(id: BinaryTreeNodeId, propertyName?: BinaryTreeNodePropertyName): number;
14
+ allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
15
+ perfectlyBalance(): boolean;
16
+ isAVLBalanced(): boolean;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { VertexId } from '../types';
2
+ import { IAbstractGraph } from './abstract-graph';
3
+ export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
4
+ incomingEdgesOf(vertex: V): E[];
5
+ outgoingEdgesOf(vertex: V): E[];
6
+ inDegreeOf(vertexOrId: V | VertexId): number;
7
+ outDegreeOf(vertexOrId: V | VertexId): number;
8
+ getEdgeSrc(e: E): V | null;
9
+ getEdgeDest(e: E): V | null;
10
+ removeEdgeSrcToDest(srcOrId: V | VertexId, destOrId: V | VertexId): E | null;
11
+ removeEdgesBetween(v1: V | VertexId, v2: V | VertexId): E[];
12
+ }
@@ -1,13 +1,15 @@
1
+ export * from './abstract-binary-tree';
2
+ export * from './abstract-graph';
3
+ export * from './avl-tree';
1
4
  export * from './binary-tree';
2
5
  export * from './bst';
3
- export * from './avl-tree';
4
- export * from './segment-tree';
5
- export * from './tree-multiset';
6
- export * from './abstract-graph';
7
6
  export * from './directed-graph';
8
- export * from './priority-queue';
9
- export * from './heap';
10
- export * from './singly-linked-list';
11
7
  export * from './doubly-linked-list';
8
+ export * from './heap';
12
9
  export * from './navigator';
13
- export * from './utils';
10
+ export * from './priority-queue';
11
+ export * from './rb-tree';
12
+ export * from './segment-tree';
13
+ export * from './singly-linked-list';
14
+ export * from './tree-multiset';
15
+ export * from './undirected-graph';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./abstract-binary-tree"), exports);
18
+ __exportStar(require("./abstract-graph"), exports);
19
+ __exportStar(require("./avl-tree"), exports);
20
+ __exportStar(require("./binary-tree"), exports);
21
+ __exportStar(require("./bst"), exports);
22
+ __exportStar(require("./directed-graph"), exports);
23
+ __exportStar(require("./doubly-linked-list"), exports);
24
+ __exportStar(require("./heap"), exports);
25
+ __exportStar(require("./navigator"), exports);
26
+ __exportStar(require("./priority-queue"), exports);
27
+ __exportStar(require("./rb-tree"), exports);
28
+ __exportStar(require("./segment-tree"), exports);
29
+ __exportStar(require("./singly-linked-list"), exports);
30
+ __exportStar(require("./tree-multiset"), exports);
31
+ __exportStar(require("./undirected-graph"), exports);
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { RBTreeNode } from '../data-structures';
2
+ import { IBST, IBSTNode } from './bst';
3
+ import { BinaryTreeNodeId } from '../types';
4
+ export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
5
+ }
6
+ export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
7
+ createNode(id: BinaryTreeNodeId, val?: N['val'], count?: number): N;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });