Heap

object Heap
Companion:
class
Source:
Heap.scala
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Heap.type

Type members

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from:
Mirror
Source:
Mirror.scala

The name of the type

The name of the type

Inherited from:
Mirror
Source:
Mirror.scala

Value members

Concrete methods

def apply[A](x: A): Heap[A]
Source:
Heap.scala
def empty[A]: Heap[A]
Source:
Heap.scala
def fromIterable[A](as: Iterable[A])(implicit order: Order[A]): Heap[A]

alias for heapify

alias for heapify

Source:
Heap.scala
def heapify[A](a: Iterable[A])(implicit order: Order[A]): Heap[A]

Build a heap using an Iterable Order O(n)

Build a heap using an Iterable Order O(n)

Source:
Heap.scala
def takeLargest[A](as: Iterable[A], count: Int)(implicit order: Order[A]): Heap[A]

this is useful for finding the k maximum values in O(N) times for N items same as as.toList.sorted.reverse.take(count), but O(N log(count)) vs O(N log N) for a full sort. When N is very large, this can be a very large savings

this is useful for finding the k maximum values in O(N) times for N items same as as.toList.sorted.reverse.take(count), but O(N log(count)) vs O(N log N) for a full sort. When N is very large, this can be a very large savings

Source:
Heap.scala

Implicits

Implicits

implicit def catsCollectionHeapOrder[A : Order]: Order[Heap[A]]

This is the same order as you would get by doing .toList and ordering by that

This is the same order as you would get by doing .toList and ordering by that

Source:
Heap.scala
implicit def toShowable[A](implicit s: Show[A], order: Order[A]): Show[Heap[A]]
Source:
Heap.scala