Package-level declarations

Types

Link copied to clipboard
class Heap<T>

A simple, generic heap implementation that uses a caller provided function to enable heaps of custom types.

Link copied to clipboard
fun interface SortTest<T>

Defines a function that is used to verify the sorting of elements in a Heap instance.

Functions

Link copied to clipboard
fun <T> heapOf(vararg values: T, fn: SortTest<T>): Heap<T>

Creates a new heap containing the given values, sorted by the given SortTest function.

fun <T> heapOf(values: Iterable<T>, fn: SortTest<T>): Heap<T>

Creates a new heap containing the values in the given iterable, sorted by the given SortTest function.

Link copied to clipboard
fun <T : Comparable<T>> maxHeapOf(vararg values: T): Heap<T>

Creates a new max-heap containing the given values.

fun <T : Comparable<T>> maxHeapOf(values: Iterable<T>): Heap<T>

Creates a new min-heap containing the given values.

Link copied to clipboard
fun <T : Comparable<T>> minHeapOf(vararg values: T): Heap<T>
fun <T : Comparable<T>> minHeapOf(values: Iterable<T>): Heap<T>

Creates a new min-heap containing the given values.