Class/Object

scalaz

Heap

Related Docs: object Heap | package scalaz

Permalink

sealed abstract class Heap[A] extends AnyRef

An efficient, asymptotically optimal, implementation of priority queues extended with support for efficient size.

The implementation of 'Heap' is based on bootstrapped skew binomial heaps as described by: G. Brodal and C. Okasaki , "Optimal Purely Functional Priority Queues", Journal of Functional Programming 6:839-857 (1996),

Based on the heaps Haskell library by Edward Kmett

Source
Heap.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Heap
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def fold[B](empty: ⇒ B, nonempty: (Int, (A, A) ⇒ Boolean, Tree[Ranked[A]]) ⇒ B): B

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def +(a: A)(implicit o: Order[A]): Heap[A]

    Permalink

    Alias for insert

  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. def adjustMin(f: (A) ⇒ A): Heap[A]

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def break(p: (A) ⇒ Boolean): (Heap[A], Heap[A])

    Permalink

    Returns a tuple where the first element is a heap consisting of the longest prefix of least elements in this heap that do not satisfy the given predicate, and the second element is the remainder of the elements.

    Returns a tuple where the first element is a heap consisting of the longest prefix of least elements in this heap that do not satisfy the given predicate, and the second element is the remainder of the elements. O(n log n)

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def deleteMin: Heap[A]

    Permalink

    Delete the minimum key from the heap and return the resulting heap.

    Delete the minimum key from the heap and return the resulting heap. O(log n)

  10. def drop(n: Int): Heap[A]

    Permalink

    Return a heap consisting of all the members of this heap except for the least n.

    Return a heap consisting of all the members of this heap except for the least n. O(n log n)

  11. def dropWhile(p: (A) ⇒ Boolean): Heap[A]

    Permalink

    Returns a heap consisting of the longest prefix of least elements of this heap that do not satisfy the predicate.

    Returns a heap consisting of the longest prefix of least elements of this heap that do not satisfy the predicate. O(n log n)

  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  14. def exists(f: (A) ⇒ Boolean): Boolean

    Permalink
  15. def filter(p: (A) ⇒ Boolean): Heap[A]

    Permalink

    Filter the heap, retaining only values that satisfy the predicate.

    Filter the heap, retaining only values that satisfy the predicate. O(n)

  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def flatMap[B](f: (A) ⇒ Heap[B])(implicit arg0: Order[B]): Heap[B]

    Permalink

    Construct heaps from each element in this heap and union them together into a new heap.

    Construct heaps from each element in this heap and union them together into a new heap. O(n)

  18. def foldRight[B](z: B)(f: (A, ⇒ B) ⇒ B): B

    Permalink
  19. def forall(f: (A) ⇒ Boolean): Boolean

    Permalink
  20. def foreach(f: (A) ⇒ Unit): Unit

    Permalink
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. def insert(a: A)(implicit o: Order[A]): Heap[A]

    Permalink

    Insert a new value into the heap.

    Insert a new value into the heap. O(1)

  24. def insertAll(as: TraversableOnce[A])(implicit o: Order[A]): Heap[A]

    Permalink
  25. def insertAllF[F[_]](as: F[A])(implicit F: Foldable[F], o: Order[A]): Heap[A]

    Permalink
  26. def isEmpty: Boolean

    Permalink

    Is the heap empty? O(1)

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def map[B](f: (A) ⇒ B)(implicit arg0: Order[B]): Heap[B]

    Permalink

    Map a function over the heap, returning a new heap ordered appropriately.

    Map a function over the heap, returning a new heap ordered appropriately. O(n)

  29. def minimum: A

    Permalink

    Get the minimum key on the (nonempty) heap.

    Get the minimum key on the (nonempty) heap. O(1)

  30. def minimumO: Option[A]

    Permalink

    Get the minimum key on the (nonempty) heap.

    Get the minimum key on the (nonempty) heap. O(1)

  31. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  32. final def nonEmpty: Boolean

    Permalink

    Is the heap populated? O(1)

  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. def nub: Heap[A]

    Permalink

    Remove duplicate entries from the heap.

    Remove duplicate entries from the heap. O(n log n)

  36. def partition(p: (A) ⇒ Boolean): (Heap[A], Heap[A])

    Permalink

    Partition the heap according to a predicate.

    Partition the heap according to a predicate. The first heap contains all elements that satisfy the predicate. The second contains all elements that fail the predicate. O(n)

  37. def size: Int

    Permalink

    The number of elements in the heap.

    The number of elements in the heap. O(1)

  38. def span(p: (A) ⇒ Boolean): (Heap[A], Heap[A])

    Permalink

    Returns a tuple where the first element is a heap consisting of the longest prefix of least elements in this heap that satisfy the given predicate and the second element is the remainder of the elements.

    Returns a tuple where the first element is a heap consisting of the longest prefix of least elements in this heap that satisfy the given predicate and the second element is the remainder of the elements. O(n log n)

  39. def split(a: A): (Heap[A], Heap[A], Heap[A])

    Permalink

    Partition the heap of the elements that are less than, equal to, and greater than a given value.

    Partition the heap of the elements that are less than, equal to, and greater than a given value. O(n)

  40. def splitAt(n: Int): (Heap[A], Heap[A])

    Permalink

    Split into two heaps, the first containing the n least elements, the second containing the n greatest elements.

    Split into two heaps, the first containing the n least elements, the second containing the n greatest elements. O(n log n)

  41. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  42. def take(n: Int): Heap[A]

    Permalink

    Return a heap consisting of the least n elements of this heap.

    Return a heap consisting of the least n elements of this heap. O(n log n)

  43. def takeWhile(p: (A) ⇒ Boolean): Heap[A]

    Permalink

    Returns a heap consisting of the longest prefix of least elements of this heap that satisfy the predicate.

    Returns a heap consisting of the longest prefix of least elements of this heap that satisfy the predicate. O(n log n)

  44. def toList: List[A]

    Permalink
  45. def toStream: Stream[A]

    Permalink
  46. def toString(): String

    Permalink
    Definition Classes
    Heap → AnyRef → Any
  47. def toUnsortedList: List[A]

    Permalink
  48. def toUnsortedStream: Stream[A]

    Permalink
  49. def traverse[F[_], B](f: (A) ⇒ F[B])(implicit arg0: Applicative[F], arg1: Order[B]): F[Heap[B]]

    Permalink

    Traverse the elements of the heap in sorted order and produce a new heap with applicative effects.

    Traverse the elements of the heap in sorted order and produce a new heap with applicative effects. O(n log n)

  50. def uncons: Option[(A, Heap[A])]

    Permalink

    Split the heap into the minimum element and the remainder.

    Split the heap into the minimum element and the remainder. O(log n)

  51. def union(as: Heap[A]): Heap[A]

    Permalink

    Meld the values from two heaps into one heap.

    Meld the values from two heaps into one heap. O(1)

  52. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  53. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped