November 2017
Intermediate to advanced
262 pages
4h 34m
English
© Thomas Mailund 2017
Thomas Mailund, Functional Data Structures in R, https://doi.org/10.1007/978-1-4842-3144-9_5
Thomas Mailund1
(1)Aarhus N, Denmark
Heaps, or priority queues, are collections of elements from an ordered set where besides checking for emptiness and inserting elements
is_empty <- function(x) UseMethod("is_empty")insert <- function(x, elm) UseMethod("insert")
we can also access and delete the smallest element:1
find_minimal <- function(heap) UseMethod("find_minimal")delete_minimal <- function(heap) UseMethod("delete_minimal")
Heaps do not necessarily contain sets. It is possible for heaps to have multiple elements with the same value.
In addition to these operations, we will also require that we can merge two heaps:
merge <- ...Read now
Unlock full access