2010-02-01から1日間の記事一覧

Gaucheでヒープ

練習に「常に子よりも親が大きい(小さい)値の二分木をヒープという」を Gauche で書いてみた。 (use gauche.collection) (use gauche.uvector) (use srfi-43) ;;vector-swap! ;; 親の位置 (define (parent n) (quotient (- n 1) 2)) (define (vct-swap v x…