<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sirocco</author_name>
  <author_url>https://blog.hatena.ne.jp/sirocco/</author_url>
  <blog_title>sirocco の書いてもすぐに忘れるメモ</blog_title>
  <blog_url>https://sirocco.hatenadiary.org/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Algorithm</anon>
  </categories>
  <description>常に子よりも親が大きい（小さい）値の二分木をヒープという。2分木を配列で表現すると各要素の位置関係は n の親は n - 1 / 2 n の左の子は 2 * n + 1 n の右の子は 2 * (n + 1) となる。 0 | +--+--+ 1 2 | | +-+-+ +-+-+ | | | | 3 4 5 6 [0,1,2,3,4,5,6] S式で表現すると以下になる。 (0 ;; 0 には 1 と 2 の子がある。 (1 (3 * *) (4 * *)) (2 (5 * *) (6 * *)))ヒープの条件を満たしながらデータを追加していく。 def parent(n); (n - 1)…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsirocco.hatenadiary.org%2Fentry%2F20100103%2F1262474543&quot; title=&quot;常に子よりも親が大きい（小さい）値の二分木をヒープという。 - sirocco の書いてもすぐに忘れるメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-01-03 08:22:23</published>
  <title>常に子よりも親が大きい（小さい）値の二分木をヒープという。</title>
  <type>rich</type>
  <url>https://sirocco.hatenadiary.org/entry/20100103/1262474543</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
