摘要: 代码#heap_sort.rb def max_heap? array (array.size-1).downto(1) do |i| parent = (i-1)/2 return false if array[parent] < array[i] end trueenddef max_heap_unshift_down array, tail i = tail while i > ... 阅读全文
posted @ 2010-05-30 00:45 napoleon_liu 阅读(359) 评论(0) 推荐(1) 编辑