[ library(heaps) | Reference Manual | Alphabetic Index ]

# list_to_heap(+List, -Heap)

takes a list of Key-Datum pairs and forms them into a heap

## Description

takes a list of Key-Datum pairs (such as keysort could be used to sort) and forms them into a heap. We could do that a wee bit faster by keysorting the list and building the tree directly, but this algorithm makes it obvious that the result is a heap, and could be adapted for use when the ordering predicate is not @< and hence keysort is inapplicable.