{"provider_name":"Hatena Blog","provider_url":"https://hatena.blog","height":"190","type":"rich","width":"100%","image_url":null,"blog_title":"sirocco \u306e\u66f8\u3044\u3066\u3082\u3059\u3050\u306b\u5fd8\u308c\u308b\u30e1\u30e2","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsirocco.hatenadiary.org%2Fentry%2F20100103%2F1262509599\" title=\"\u30d2\u30fc\u30d7\u30bd\u30fc\u30c8\u3092\u3084\u3063\u3066\u307f\u308b\u3002 - sirocco \u306e\u66f8\u3044\u3066\u3082\u3059\u3050\u306b\u5fd8\u308c\u308b\u30e1\u30e2\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_url":"https://blog.hatena.ne.jp/sirocco/","blog_url":"https://sirocco.hatenadiary.org/","version":"1.0","url":"https://sirocco.hatenadiary.org/entry/20100103/1262509599","title":"\u30d2\u30fc\u30d7\u30bd\u30fc\u30c8\u3092\u3084\u3063\u3066\u307f\u308b\u3002","description":"\u5e38\u306b\u5b50\u3088\u308a\u3082\u89aa\u304c\u5927\u304d\u3044\uff08\u5c0f\u3055\u3044\uff09\u5024\u306e\u4e8c\u5206\u6728\u3092\u30d2\u30fc\u30d7\u3068\u3044\u3046\u3002 \u4eca\u5ea6\u306f\u30d2\u30fc\u30d7\u3092\u4f7f\u3063\u305f\u30bd\u30fc\u30c8\u3001\u30d2\u30fc\u30d7\u30bd\u30fc\u30c8\u3092\u3084\u3063\u3066\u307f\u307e\u3059\u3002 def heap(array,n) if n > 0 parent = (n - 1) / 2 # \u89aa\u306e\u4f4d\u7f6e if array[n] > array[parent] tmp = array[n] array[n] = array[parent] array[parent] = tmp end heap(array,parent) end end def out(array,sorted) (array.size-1).downto(1) do |n| heap(array,n)\u2026","published":"2010-01-03 18:06:39","categories":["Ruby","Algorithm"],"author_name":"sirocco"}