相変わらず,コストは無視しています.
quickSort := [:array | | x xs left right | array isEmpty ifTrue:[ array ] ifFalse:[ x := array first. xs := array allButFirst. left := xs select:[:v | v < x]. right := xs select:[:v | v >= x]. (quickSort copy fixTemps value: left),(Array with:x), (quickSort copy fixTemps value:right )]]. quickSort copy fixTemps value: #(30 10 20 40 80 60) .
やっぱりSqueak 4.1がいい!
0 件のコメント:
コメントを投稿