Next: , Previous: , Up: Data Structures   [Contents][Index]

5.6.3 Heaps

The (chickadee data heap) module provides a binary heap data structure. The heap orders data from smallest to largest, according to a custom comparison predicate, making it a good choice for priority queues.

Procedure: make-heap [#:< <]

Return a new heap that uses the predicate < to determine order.

Procedure: heap? obj

Return #t if obj is a heap.

Procedure: heap-empty? heap

Return #t if heap is empty.

Procedure: heap-size heap

Return the current size of heap.

Procedure: heap-min heap

Return the minimum item in heap.

Procedure: heap-insert! heap item

Add item to heap.

Procedure: heap-remove! heap

Remove the minimum item in heap.

Procedure: heap-clear! heap

Remove all items from heap.