File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import RedBlackTree from '../types/RedBlackTree.js' ;
2+
3+ /**
4+ * Same as {@link RedBlackTree.empty}.
5+ * @function empty
6+ */
7+ const empty = RedBlackTree . empty ;
8+ export default empty ;
Original file line number Diff line number Diff line change 1+ import RedBlackTree from '../types/RedBlackTree.js' ;
2+
3+ /**
4+ * Same as {@link RedBlackTree.from}.
5+ * @function from
6+ */
7+ const from = RedBlackTree . from ;
8+ export default from ;
Original file line number Diff line number Diff line change 1+ export { default as empty } from './api/empty.js' ;
2+ export { default as from } from './api/from.js' ;
13export { default as BLACK } from './color/BLACK.js' ;
24export { default as RED } from './color/RED.js' ;
35export { default as _debug } from './debug/_debug.js' ;
Original file line number Diff line number Diff line change @@ -165,6 +165,16 @@ export default class RedBlackTree {
165165 return this . items ( ) ;
166166 }
167167
168+ /**
169+ * Constructs an empty red-black tree.
170+ *
171+ * @param {Function } compare - The comparison function to use.
172+ * @returns {RedBlackTree }
173+ */
174+ static empty ( compare ) {
175+ return new RedBlackTree ( compare ) ;
176+ }
177+
168178 /**
169179 * Constructs a red-black tree from an input iterable.
170180 *
You can’t perform that action at this time.
0 commit comments