Author: rneeser Date: Sun Dec 20 02:07:15 2009 New Revision: 9 Log: * binary-heap.lisp (add-to-heap, add-all-to-heap): Fixed a bug in updating the size of the DATA array in the BINARY-HEAP class. Modified: cl-heap/trunk/ChangeLog cl-heap/trunk/binary-heap.lisp Modified: cl-heap/trunk/ChangeLog ============================================================================== --- cl-heap/trunk/ChangeLog (original) +++ cl-heap/trunk/ChangeLog Sun Dec 20 02:07:15 2009 @@ -1,3 +1,8 @@ +2009-12-20 Rudy Neeser <rudy.neeser@gmail.com> + + * binary-heap.lisp (add-to-heap, add-all-to-heap): Fixed a bug in + updating the size of the DATA array in the BINARY-HEAP class. + 2009-06-18 Rudy Neeser <rudy.neeser@gmail.com> * fibonacci-heap.lisp (pop-heap): Fixed a bug which created an Modified: cl-heap/trunk/binary-heap.lisp ============================================================================== --- cl-heap/trunk/binary-heap.lisp (original) +++ cl-heap/trunk/binary-heap.lisp Sun Dec 20 02:07:15 2009 @@ -1,3 +1,4 @@ +(declaim (optimize (debug 3) (safety 3) (speed 0))) ;;; Copyright 2009 Rudolph Neeser <rudy.neeser@gmail.com>. ;;; ;;; This file is part of CL-HEAP @@ -131,7 +132,7 @@ number of items in the heap." (with-slots (data (factor extension-factor)) heap - (vector-push-extend item data (ceiling (* (/ factor 100) (length data)))) + (vector-push-extend item data (ceiling (* (/ factor 100) (array-total-size data)))) (values item (percolate-up heap (1- (length data)))))) (defmethod pop-heap ((heap binary-heap)) @@ -153,7 +154,7 @@ (factor extension-factor)) heap ;; Add all items, which is linear time since no sorting occurs here. (loop for item in items - do (vector-push-extend item data (ceiling (* (/ factor 100) (length data))))) + do (vector-push-extend item data (ceiling (* (/ factor 100) (array-total-size data))))) (loop for position from (parent-position (1- (length data))) downto 0 do (percolate-down heap position))) heap)
participants (1)
-
Rudy Neeser