mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
chore(data-structures): remove redundant constructor examples (#5510)
chore(data-structures): remove constructor examples
This commit is contained in:
parent
482d28ac11
commit
54f6277ce2
@ -66,20 +66,6 @@ export class BinaryHeap<T> implements Iterable<T> {
|
||||
/**
|
||||
* Construct an empty binary heap.
|
||||
*
|
||||
* @example Creating an empty binary heap
|
||||
* ```ts no-assert
|
||||
* import { BinaryHeap } from "@std/data-structures";
|
||||
*
|
||||
* const heap = new BinaryHeap<number>();
|
||||
* ```
|
||||
*
|
||||
* @example Creating a binary heap with a custom comparison function
|
||||
* ```ts no-assert
|
||||
* import { BinaryHeap, ascend } from "@std/data-structures";
|
||||
*
|
||||
* const heap = new BinaryHeap(ascend);
|
||||
* ```
|
||||
*
|
||||
* @param compare A custom comparison function to sort the values in the heap. By default, the values are sorted in descending order.
|
||||
*/
|
||||
constructor(compare: (a: T, b: T) => number = descend) {
|
||||
|
@ -98,22 +98,6 @@ export class BinarySearchTree<T> implements Iterable<T> {
|
||||
/**
|
||||
* Construct an empty binary search tree.
|
||||
*
|
||||
* @example Creating an empty binary search tree
|
||||
* ```ts no-assert
|
||||
* import { BinarySearchTree } from "@std/data-structures";
|
||||
*
|
||||
* const tree = new BinarySearchTree<number>();
|
||||
* ```
|
||||
*
|
||||
* @example Creating a binary search tree with a custom comparison function
|
||||
* ```ts no-assert
|
||||
* import { BinarySearchTree, ascend } from "@std/data-structures";
|
||||
*
|
||||
* const tree = new BinarySearchTree<{ price: number, name: string }>(
|
||||
* (a, b) => ascend(a.price, b.price) || ascend(a.name, b.name)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* To create a binary search tree from an array like, an iterable object, or an
|
||||
* existing binary search tree, use the {@link BinarySearchTree.from} method.
|
||||
*
|
||||
|
@ -104,22 +104,6 @@ export class RedBlackTree<T> extends BinarySearchTree<T> {
|
||||
/**
|
||||
* Construct an empty red-black tree.
|
||||
*
|
||||
* @example Creating an empty red-black tree
|
||||
* ```ts no-assert
|
||||
* import { RedBlackTree } from "@std/data-structures";
|
||||
*
|
||||
* const tree = new RedBlackTree<number>();
|
||||
* ```
|
||||
*
|
||||
* @example Creating a red-black tree with a custom comparison function
|
||||
* ```ts no-assert
|
||||
* import { RedBlackTree, ascend } from "@std/data-structures";
|
||||
*
|
||||
* const tree = new RedBlackTree<{ price: number, name: string }>(
|
||||
* (a, b) => ascend(a.price, b.price) || ascend(a.name, b.name)
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @param compare A custom comparison function for the values. The default comparison function sorts by ascending order.
|
||||
*/
|
||||
constructor(compare: (a: T, b: T) => number = ascend) {
|
||||
|
Loading…
Reference in New Issue
Block a user