Fix spelling, remove debug code

This commit is contained in:
Ray Miller 2024-12-07 17:03:08 +00:00
parent c36209028d
commit e67e57b604
Signed by: ray
GPG key ID: 043F786C4CD681B8

View file

@ -8,12 +8,11 @@
pq-empty? pq-empty?
pq-drain!)) 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. ;; to Algorithms" by Cormen, Leiserson, Rivest, and Stein.
;; We store the heap in a vector with the first element storing the ;; We store the heap in a vector. The first element of the vector is the current
;; current heap size. This means elements of the heap are indexed starting ;; heap size, so elements of the heap are indexed starting from 1.
;; from 1.
(define (parent i) (define (parent i)
(floor-quotient i 2)) (floor-quotient i 2))
@ -50,7 +49,7 @@
(loop l))))))) (loop l)))))))
;; The swim function is used to restore the heap property when a new node is ;; 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. ;; "swim" up the heap to maintain the order.
(define (swim A i priority cmp) (define (swim A i priority cmp)
(let loop ((i i)) (let loop ((i i))
@ -66,8 +65,6 @@
(let ((A (make-vector initial-capacity))) (let ((A (make-vector initial-capacity)))
(vector-set! A 0 0) (vector-set! A 0 0)
(match-lambda* (match-lambda*
(('dump)
A)
(('size) (('size)
(vector-ref A 0)) (vector-ref A 0))
(('peek) (('peek)