Fix spelling, remove debug code
This commit is contained in:
parent
c36209028d
commit
e67e57b604
1 changed files with 4 additions and 7 deletions
|
@ -8,12 +8,11 @@
|
|||
pq-empty?
|
||||
pq-drain!))
|
||||
|
||||
;; The heap implementation is the based on Chapter 6: Heapsort of "Introduction
|
||||
;; The heap implementation is based on "Chapter 6: Heapsort" from "Introduction
|
||||
;; to Algorithms" by Cormen, Leiserson, Rivest, and Stein.
|
||||
|
||||
;; We store the heap in a vector with the first element storing the
|
||||
;; current heap size. This means elements of the heap are indexed starting
|
||||
;; from 1.
|
||||
;; We store the heap in a vector. The first element of the vector is the current
|
||||
;; heap size, so elements of the heap are indexed starting from 1.
|
||||
|
||||
(define (parent i)
|
||||
(floor-quotient i 2))
|
||||
|
@ -50,7 +49,7 @@
|
|||
(loop l)))))))
|
||||
|
||||
;; The swim function is used to restore the heap property when a new node is
|
||||
;; added to the heap: it's initally added at the end of the heap and may need to
|
||||
;; added to the heap: it's initially added at the end of the heap and may need to
|
||||
;; "swim" up the heap to maintain the order.
|
||||
(define (swim A i priority cmp)
|
||||
(let loop ((i i))
|
||||
|
@ -66,8 +65,6 @@
|
|||
(let ((A (make-vector initial-capacity)))
|
||||
(vector-set! A 0 0)
|
||||
(match-lambda*
|
||||
(('dump)
|
||||
A)
|
||||
(('size)
|
||||
(vector-ref A 0))
|
||||
(('peek)
|
||||
|
|
Loading…
Reference in a new issue