chore(data-structures): remove redundant constructor examples (#5510)

chore(data-structures): remove constructor examples
This commit is contained in:
Asher Gomez 2024-07-23 13:05:43 +10:00 committed by GitHub
parent 482d28ac11
commit 54f6277ce2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 46 deletions

View File

@ -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) {

View File

@ -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.
*

View File

@ -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) {