Held: Monday, 7 April 2003
Summary: Today we go over some of the key issues from exam 2.
binary-search: use indices to keep track of the lower and upper bounds of the parts.
split into two partspart.
define partition! (let ((swap! (lambda (vec i j) (let ((tmp (vector-ref vec i))) (vector-set! vec i (vector-ref vec j)) (vector-set! vec j tmp))))) (lambda (vec lower upper can-come-before?) (if (= lower upper) lower (begin (let kernel! ((l lower) (u upper)) (cond ((= u l) (begin (swap! vec lower u) u)) ((not (can-come-before? (vector-ref vec u) (vector-ref vec lower))) (kernel! l (- u 1))) ((can-come-before? (vector-ref vec l) (vector-ref vec lower)) (kernel! (+ l 1) u)) (else (begin (swap! vec l u) (kernel! l u))))))))))
Thursday, 15 January 2003 [Samuel A. Rebelsky]
Sunday, 6 April 2003 [Samuel A. Rebelsky]
I usually create these pages
on the fly, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:20:55 2003.
The source to the document was last modified on Sun Apr 6 23:20:49 2003.
This document may be found at