Skip to content

Instantly share code, notes, and snippets.

@blakesmith
Created November 11, 2013 15:48
Show Gist options
  • Save blakesmith/7415308 to your computer and use it in GitHub Desktop.
Save blakesmith/7415308 to your computer and use it in GitHub Desktop.
property("sorted delete") = forAll { (h: H) =>
def getSeq(l: List[A], heap: H): List[A] = isEmpty(heap) match {
case true => l.reverse
case false => getSeq(findMin(heap) :: l, deleteMin(heap))
}
val deleted = getSeq(List(), h)
deleted == deleted.sorted
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment