<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>deve68</author_name>
  <author_url>https://blog.hatena.ne.jp/deve68/</author_url>
  <blog_title>コードの恵み</blog_title>
  <blog_url>https://deve68.hatenadiary.org/</blog_url>
  <categories>
    <anon>algorithm</anon>
    <anon>.groovy</anon>
  </categories>
  <description>ハフマン符号はデータ圧縮の手法で 『プログラミングコンテストチャレンジブック』 によると貪欲法になるらしい。 出現頻度が高い文字により短い符号を割り当てるので元の文字列より圧縮できる。 エンコードの手順 文字列から頻度表を作成する 頻度表からハフマン木を作成する ハフマン木からコード表を作成する コード表を使って文字列をエンコードする デコードの際はコード表がなくてもハフマン木と長さが分かっていれば復号できる。 Java には bit 単位の入出力がないので文字列まま処理した。 // 文字列から頻度表を作成する def freq(str) { str.toList().countBy { it…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdeve68.hatenadiary.org%2Fentry%2F20110627%2F1309186103&quot; title=&quot; Huffman coding - コードの恵み&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>2011-06-27 23:48:23</published>
  <title> Huffman coding</title>
  <type>rich</type>
  <url>https://deve68.hatenadiary.org/entry/20110627/1309186103</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
