chickadee » heap » heap->list

heap->list heapprocedure

Convert the heap into a key-sorted list of values by iteratively extracting the extremum; see also heap->alist.

heap
The heap to convert
(define (heap->list heap)
  (let ((heap (heap-copy heap)))
    (do ((list '() (cons (heap-extract-extremum! heap) list)))
        ((heap-empty? heap) list))))