From e67e57b604123b2845829ef55dc474e8a927bfc7 Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Sat, 7 Dec 2024 17:03:08 +0000 Subject: [PATCH] Fix spelling, remove debug code --- algo/priority-queue.scm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/algo/priority-queue.scm b/algo/priority-queue.scm index b633fed..c5d38ec 100644 --- a/algo/priority-queue.scm +++ b/algo/priority-queue.scm @@ -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)