https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Package-merge_algorithmPackage-merge algorithm - Revision history2025-06-28T04:09:56ZRevision history for this page on the wikiMediaWiki 1.45.0-wmf.7https://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=1181598701&oldid=prevOnel5969: Disambiguating links to Code word (link changed to Code word (communication)) using DisamAssist.2023-10-24T01:40:18Z<p>Disambiguating links to <a href="/wiki/Code_word" title="Code word">Code word</a> (link changed to <a href="/wiki/Code_word_(communication)" title="Code word (communication)">Code word (communication)</a>) using <a href="/wiki/User:Qwertyytrewqqwerty/DisamAssist" title="User:Qwertyytrewqqwerty/DisamAssist">DisamAssist</a>.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:40, 24 October 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150|s2cid=11696729 |doi-access=free }}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[<ins style="font-weight: bold; text-decoration: none;">Code word (communication)|</ins>code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150|s2cid=11696729 |doi-access=free }}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
</table>Onel5969https://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=1170291323&oldid=prevOAbot: Open access bot: doi updated in citation with #oabot.2023-08-14T05:56:19Z<p><a href="/wiki/Wikipedia:OABOT" class="mw-redirect" title="Wikipedia:OABOT">Open access bot</a>: doi updated in citation with #oabot.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 05:56, 14 August 2023</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150|s2cid=11696729 }}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150|s2cid=11696729<ins style="font-weight: bold; text-decoration: none;"> |doi-access=free</ins> }}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
</table>OAbothttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=1068818339&oldid=prevCitation bot: Alter: template type. Add: s2cid. | Use this bot. Report bugs. | Suggested by AManWithNoPlan | #UCB_webform 437/16822022-01-30T09:47:23Z<p>Alter: template type. Add: s2cid. | <a href="/wiki/Wikipedia:UCB" class="mw-redirect" title="Wikipedia:UCB">Use this bot</a>. <a href="/wiki/Wikipedia:DBUG" class="mw-redirect" title="Wikipedia:DBUG">Report bugs</a>. | Suggested by AManWithNoPlan | #UCB_webform 437/1682</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 09:47, 30 January 2022</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[Coupon collector's problem|coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150<ins style="font-weight: bold; text-decoration: none;">|s2cid=11696729 </ins>}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 30:</td>
<td colspan="2" class="diff-lineno">Line 30:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==External links==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==External links==</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* {{cite <del style="font-weight: bold; text-decoration: none;">arxiv</del> |first=Michael B. |last=Baer |eprint=cs.IT/0602085 |title=Twenty (or so) Questions: ''D''-ary Length-Bounded Prefix Coding|year=2006 }}<!-- Please do not add as a reference; it has not yet been peer-reviewed, but it does survey and expand upon the techniques and literature on this subject --></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* {{cite <ins style="font-weight: bold; text-decoration: none;">arXiv</ins> |first=Michael B. |last=Baer |eprint=cs.IT/0602085 |title=Twenty (or so) Questions: ''D''-ary Length-Bounded Prefix Coding|year=2006 }}<!-- Please do not add as a reference; it has not yet been peer-reviewed, but it does survey and expand upon the techniques and literature on this subject --></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
</tr>
</table>Citation bothttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=1059982315&oldid=prevDavid Eppstein: Teresa Przytycka2021-12-12T20:26:27Z<p><a href="/wiki/Teresa_Przytycka" title="Teresa Przytycka">Teresa Przytycka</a></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 20:26, 12 December 2021</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 22:</td>
<td colspan="2" class="diff-lineno">Line 22:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>With this reduction, the algorithm is ''O(nL)''-time and ''O(nL)''-space. However, the original paper, "''A fast algorithm for optimal length-limited Huffman codes''", shows how this can be improved to ''O(nL)''-time and ''O(n)''-space. The idea is to run the algorithm a first time, only keeping enough data to be able to determine two equivalent subproblems that sum to half the size of the original problem. This is done recursively, resulting in an algorithm that takes about twice as long but requires only linear space.<ref name="LaHi"/></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>With this reduction, the algorithm is ''O(nL)''-time and ''O(nL)''-space. However, the original paper, "''A fast algorithm for optimal length-limited Huffman codes''", shows how this can be improved to ''O(nL)''-time and ''O(n)''-space. The idea is to run the algorithm a first time, only keeping enough data to be able to determine two equivalent subproblems that sum to half the size of the original problem. This is done recursively, resulting in an algorithm that takes about twice as long but requires only linear space.<ref name="LaHi"/></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Many other improvements have been made to the package-merge algorithm to reduce the [[Big O notation|multiplicative constant]] and to make it faster in special cases, such as those problems having repeated ''p<sub>i</sub>''s.<ref name="MG">{{cite book |first1=Ian H. |last1=Witten |author-link1=Ian H. Witten | first2=Alistair |last2=Moffat |author-link2=Alistair Moffat (computer scientist) |first3=Timothy Clinton |last3=Bell |author-link3=Timothy Clinton Bell |title=Managing Gigabytes: Compressing and indexing documents and images |edition=2 |publisher=[[Morgan Kaufmann Publishers]] |date=1999 |isbn=978-1-55860-570-1 |id=1558605703}}</ref> The package-merge approach has also been adapted to related problems such as [[alphabetic Huffman coding|alphabetic coding]].<ref name="LaPr">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Teresa M. |last2=Przytycka |title=A Fast Algorithm for Optimal Height-Limited Alphabetic Binary-Trees |journal=[[SIAM Journal on Computing]] |volume=23 |number=6 |pages=1283–1312 |date=1994 |doi=10.1137/s0097539792231167}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Many other improvements have been made to the package-merge algorithm to reduce the [[Big O notation|multiplicative constant]] and to make it faster in special cases, such as those problems having repeated ''p<sub>i</sub>''s.<ref name="MG">{{cite book |first1=Ian H. |last1=Witten |author-link1=Ian H. Witten | first2=Alistair |last2=Moffat |author-link2=Alistair Moffat (computer scientist) |first3=Timothy Clinton |last3=Bell |author-link3=Timothy Clinton Bell |title=Managing Gigabytes: Compressing and indexing documents and images |edition=2 |publisher=[[Morgan Kaufmann Publishers]] |date=1999 |isbn=978-1-55860-570-1 |id=1558605703}}</ref> The package-merge approach has also been adapted to related problems such as [[alphabetic Huffman coding|alphabetic coding]].<ref name="LaPr">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Teresa M. |last2=<ins style="font-weight: bold; text-decoration: none;">Przytycka|author2-link=Teresa </ins>Przytycka |title=A Fast Algorithm for Optimal Height-Limited Alphabetic Binary-Trees |journal=[[SIAM Journal on Computing]] |volume=23 |number=6 |pages=1283–1312 |date=1994 |doi=10.1137/s0097539792231167}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Methods involving [[graph theory]] have been shown to have better asymptotic space complexity than the package-merge algorithm, but these have not seen as much practical application.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Methods involving [[graph theory]] have been shown to have better asymptotic space complexity than the package-merge algorithm, but these have not seen as much practical application.</div></td>
</tr>
</table>David Eppsteinhttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=1042806814&oldid=prevDabbleE: Updated link text to reflect cross-page title change.2021-09-06T21:35:17Z<p>Updated link text to reflect cross-page title change.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 21:35, 6 September 2021</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[<ins style="font-weight: bold; text-decoration: none;">Coupon collector's problem|</ins>coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464–473 |date=1990 |doi=10.1145/79147.79150}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
</table>DabbleEhttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=933173217&oldid=prevBotaki: /* External links */2019-12-30T10:56:53Z<p><span class="autocomment">External links</span></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 10:56, 30 December 2019</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 33:</td>
<td colspan="2" class="diff-lineno">Line 33:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
</tr>
<tr>
<td colspan="2" class="diff-empty diff-side-deleted"></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* A fast entropy coder that uses package-merge algorithm [https://github.com/algorithm314/FPC]</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Lossless compression algorithms]]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Lossless compression algorithms]]</div></td>
</tr>
</table>Botakihttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=906457332&oldid=prevCitation bot: Removed URL that duplicated unique identifier. | You can use this bot yourself. Report bugs here.| Activated by User:Headbomb2019-07-15T23:40:32Z<p>Removed URL that duplicated unique identifier. | You can <a href="/wiki/Wikipedia:UCB" class="mw-redirect" title="Wikipedia:UCB">use this bot</a> yourself. <a href="/wiki/Wikipedia:DBUG" class="mw-redirect" title="Wikipedia:DBUG">Report bugs here</a>.| Activated by <a href="/wiki/User:Headbomb" title="User:Headbomb">User:Headbomb</a></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 23:40, 15 July 2019</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 17:</td>
<td colspan="2" class="diff-lineno">Line 17:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Let ''p''<sub>1</sub>,&nbsp;…,&nbsp;''p<sub>n</sub>'' be the frequencies of the</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Let ''p''<sub>1</sub>,&nbsp;…,&nbsp;''p<sub>n</sub>'' be the frequencies of the</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>symbols of the alphabet to be encoded. We first sort the symbols so that ''p''<sub>''i''</sub>&nbsp;≤&nbsp;''p''<sub>''i''+1</sub>. Create ''L'' coins for each symbol, of denominations 2<sup>&minus;1</sup>,&nbsp;…,&nbsp;2<sup>&minus;''L''</sup>, each of numismatic value ''p<sub>i</sub>''. Use the package-merge algorithm to select the set of coins of minimum numismatic value whose denominations total ''n''&nbsp;&minus;&nbsp;1. Let ''h<sub>i</sub>'' be the number of coins of numismatic value ''p<sub>i</sub>'' selected. </div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>symbols of the alphabet to be encoded. We first sort the symbols so that ''p''<sub>''i''</sub>&nbsp;≤&nbsp;''p''<sub>''i''+1</sub>. Create ''L'' coins for each symbol, of denominations 2<sup>&minus;1</sup>,&nbsp;…,&nbsp;2<sup>&minus;''L''</sup>, each of numismatic value ''p<sub>i</sub>''. Use the package-merge algorithm to select the set of coins of minimum numismatic value whose denominations total ''n''&nbsp;&minus;&nbsp;1. Let ''h<sub>i</sub>'' be the number of coins of numismatic value ''p<sub>i</sub>'' selected. </div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The optimal length-limited Huffman code will encode symbol ''i'' with a bit string of length ''h<sub>i</sub>''. The [[canonical Huffman code]] can easily be constructed by a simple bottom-up greedy method, given that the ''h<sub>i</sub>'' are known, and this can be the basis for fast [[data compression]].<ref name="MoTu">{{cite journal |first1=Alistair |last1=Moffat |author-link1=Alistair Moffat (computer scientist) |first2=Andrew |last2=Turpin |title=On the implementation of minimum redundancy prefix codes |journal=[[IEEE Transactions on Communications]] |volume=45 |number=10 |pages=1200–1207 |date=Oct 1997<del style="font-weight: bold; text-decoration: none;"> |url=http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=634683</del> |doi=10.1109/26.634683}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The optimal length-limited Huffman code will encode symbol ''i'' with a bit string of length ''h<sub>i</sub>''. The [[canonical Huffman code]] can easily be constructed by a simple bottom-up greedy method, given that the ''h<sub>i</sub>'' are known, and this can be the basis for fast [[data compression]].<ref name="MoTu">{{cite journal |first1=Alistair |last1=Moffat |author-link1=Alistair Moffat (computer scientist) |first2=Andrew |last2=Turpin |title=On the implementation of minimum redundancy prefix codes |journal=[[IEEE Transactions on Communications]] |volume=45 |number=10 |pages=1200–1207 |date=Oct 1997 |doi=10.1109/26.634683}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Performance improvements and generalizations==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Performance improvements and generalizations==</div></td>
</tr>
</table>Citation bothttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=887839011&oldid=prevCitation bot: Add: year, eprint. Removed parameters. | You can use this bot yourself. Report bugs here. | User-activated.2019-03-15T04:30:19Z<p>Add: year, eprint. Removed parameters. | You can <a href="/wiki/Wikipedia:UCB" class="mw-redirect" title="Wikipedia:UCB">use this bot</a> yourself. <a href="/wiki/Wikipedia:DBUG" class="mw-redirect" title="Wikipedia:DBUG">Report bugs here</a>. | <a href="/wiki/Wikipedia:UCB" class="mw-redirect" title="Wikipedia:UCB">User-activated</a>.</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 04:30, 15 March 2019</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 30:</td>
<td colspan="2" class="diff-lineno">Line 30:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==External links==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==External links==</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* {{cite arxiv |first=Michael B. |last=Baer |<del style="font-weight: bold; text-decoration: none;">arxiv</del>=cs.IT/0602085 |title=Twenty (or so) Questions: ''D''-ary Length-Bounded Prefix Coding}}<!-- Please do not add as a reference; it has not yet been peer-reviewed, but it does survey and expand upon the techniques and literature on this subject --></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* {{cite arxiv |first=Michael B. |last=Baer |<ins style="font-weight: bold; text-decoration: none;">eprint</ins>=cs.IT/0602085 |title=Twenty (or so) Questions: ''D''-ary Length-Bounded Prefix Coding<ins style="font-weight: bold; text-decoration: none;">|year=2006 </ins>}}<!-- Please do not add as a reference; it has not yet been peer-reviewed, but it does survey and expand upon the techniques and literature on this subject --></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* {{cite conference |first1=Alistair |last1=Moffat |first2=Andrew |author-link1=Alistair Moffat (computer scientist) |last2=Turpin |first3=Jyrki |last3=Katajainen |title=Space-Efficient Construction of Optimal Prefix Codes |conference=IEEE Data Compression Conference |date=March 1995 |location=Snowbird, Utah, USA |doi=10.1109/DCC.1995.515509}}</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* An implementation of the package-merge algorithm "[http://sourceforge.net/p/tpabbrevia/code/26/tree/trunk/source/AbDfPkMg.pas]"</div></td>
</tr>
</table>Citation bothttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=733225584&oldid=prevRjwilmsi: Journal cites, Added 3 dois to journal cites using AWB (12066)2016-08-06T09:17:04Z<p>Journal cites, Added 3 dois to journal cites using <a href="/wiki/Wikipedia:AWB" class="mw-redirect" title="Wikipedia:AWB">AWB</a> (12066)</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 09:17, 6 August 2016</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=<del style="font-weight: bold; text-decoration: none;">464--473</del> |date=1990}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''[[coin collector's problem]]''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=<ins style="font-weight: bold; text-decoration: none;">464–473</ins> |date=1990<ins style="font-weight: bold; text-decoration: none;"> |doi=10.1145/79147.79150</ins>}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Line 17:</td>
<td colspan="2" class="diff-lineno">Line 17:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Let ''p''<sub>1</sub>,&nbsp;…,&nbsp;''p<sub>n</sub>'' be the frequencies of the</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Let ''p''<sub>1</sub>,&nbsp;…,&nbsp;''p<sub>n</sub>'' be the frequencies of the</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>symbols of the alphabet to be encoded. We first sort the symbols so that ''p''<sub>''i''</sub>&nbsp;≤&nbsp;''p''<sub>''i''+1</sub>. Create ''L'' coins for each symbol, of denominations 2<sup>&minus;1</sup>,&nbsp;…,&nbsp;2<sup>&minus;''L''</sup>, each of numismatic value ''p<sub>i</sub>''. Use the package-merge algorithm to select the set of coins of minimum numismatic value whose denominations total ''n''&nbsp;&minus;&nbsp;1. Let ''h<sub>i</sub>'' be the number of coins of numismatic value ''p<sub>i</sub>'' selected. </div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>symbols of the alphabet to be encoded. We first sort the symbols so that ''p''<sub>''i''</sub>&nbsp;≤&nbsp;''p''<sub>''i''+1</sub>. Create ''L'' coins for each symbol, of denominations 2<sup>&minus;1</sup>,&nbsp;…,&nbsp;2<sup>&minus;''L''</sup>, each of numismatic value ''p<sub>i</sub>''. Use the package-merge algorithm to select the set of coins of minimum numismatic value whose denominations total ''n''&nbsp;&minus;&nbsp;1. Let ''h<sub>i</sub>'' be the number of coins of numismatic value ''p<sub>i</sub>'' selected. </div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The optimal length-limited Huffman code will encode symbol ''i'' with a bit string of length ''h<sub>i</sub>''. The [[canonical Huffman code]] can easily be constructed by a simple bottom-up greedy method, given that the ''h<sub>i</sub>'' are known, and this can be the basis for fast [[data compression]].<ref name="MoTu">{{cite journal |first1=Alistair |last1=Moffat |author-link1=Alistair Moffat (computer scientist) |first2=Andrew |last2=Turpin |title=On the implementation of minimum redundancy prefix codes |journal=[[IEEE Transactions on Communications]] |volume=45 |number=10 |pages=<del style="font-weight: bold; text-decoration: none;">1200-1207</del> |date=Oct 1997 |url=http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=634683}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The optimal length-limited Huffman code will encode symbol ''i'' with a bit string of length ''h<sub>i</sub>''. The [[canonical Huffman code]] can easily be constructed by a simple bottom-up greedy method, given that the ''h<sub>i</sub>'' are known, and this can be the basis for fast [[data compression]].<ref name="MoTu">{{cite journal |first1=Alistair |last1=Moffat |author-link1=Alistair Moffat (computer scientist) |first2=Andrew |last2=Turpin |title=On the implementation of minimum redundancy prefix codes |journal=[[IEEE Transactions on Communications]] |volume=45 |number=10 |pages=<ins style="font-weight: bold; text-decoration: none;">1200–1207</ins> |date=Oct 1997 |url=http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=<ins style="font-weight: bold; text-decoration: none;">634683 |doi=10.1109/26.</ins>634683}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Performance improvements and generalizations==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Performance improvements and generalizations==</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>With this reduction, the algorithm is ''O(nL)''-time and ''O(nL)''-space. However, the original paper, "''A fast algorithm for optimal length-limited Huffman codes''", shows how this can be improved to ''O(nL)''-time and ''O(n)''-space. The idea is to run the algorithm a first time, only keeping enough data to be able to determine two equivalent subproblems that sum to half the size of the original problem. This is done recursively, resulting in an algorithm that takes about twice as long but requires only linear space.<ref name="LaHi"/></div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>With this reduction, the algorithm is ''O(nL)''-time and ''O(nL)''-space. However, the original paper, "''A fast algorithm for optimal length-limited Huffman codes''", shows how this can be improved to ''O(nL)''-time and ''O(n)''-space. The idea is to run the algorithm a first time, only keeping enough data to be able to determine two equivalent subproblems that sum to half the size of the original problem. This is done recursively, resulting in an algorithm that takes about twice as long but requires only linear space.<ref name="LaHi"/></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Many other improvements have been made to the package-merge algorithm to reduce the [[Big O notation|multiplicative constant]] and to make it faster in special cases, such as those problems having repeated ''p<sub>i</sub>''s.<ref name="MG">{{cite book |first1=Ian H. |last1=Witten |author-link1=Ian H. Witten | first2=Alistair |last2=Moffat |author-link2=Alistair Moffat (computer scientist) |first3=Timothy Clinton |last3=Bell |author-link3=Timothy Clinton Bell |title=Managing Gigabytes: Compressing and indexing documents and images |edition=2 |publisher=[[Morgan Kaufmann Publishers]] |date=1999 |isbn=978-1-55860-570-1 |id=1558605703}}</ref> The package-merge approach has also been adapted to related problems such as [[alphabetic Huffman coding|alphabetic coding]].<ref name="LaPr">{{cite journal <del style="font-weight: bold; text-decoration: none;">|</del>|first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Teresa M. |last2=Przytycka |title=A Fast Algorithm for Optimal Height-Limited Alphabetic Binary-Trees |journal=[[SIAM Journal on Computing]] |volume=23 |number=6 |pages=<del style="font-weight: bold; text-decoration: none;">1283--1312</del> |date=1994}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Many other improvements have been made to the package-merge algorithm to reduce the [[Big O notation|multiplicative constant]] and to make it faster in special cases, such as those problems having repeated ''p<sub>i</sub>''s.<ref name="MG">{{cite book |first1=Ian H. |last1=Witten |author-link1=Ian H. Witten | first2=Alistair |last2=Moffat |author-link2=Alistair Moffat (computer scientist) |first3=Timothy Clinton |last3=Bell |author-link3=Timothy Clinton Bell |title=Managing Gigabytes: Compressing and indexing documents and images |edition=2 |publisher=[[Morgan Kaufmann Publishers]] |date=1999 |isbn=978-1-55860-570-1 |id=1558605703}}</ref> The package-merge approach has also been adapted to related problems such as [[alphabetic Huffman coding|alphabetic coding]].<ref name="LaPr">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Teresa M. |last2=Przytycka |title=A Fast Algorithm for Optimal Height-Limited Alphabetic Binary-Trees |journal=[[SIAM Journal on Computing]] |volume=23 |number=6 |pages=<ins style="font-weight: bold; text-decoration: none;">1283–1312</ins> |date=1994<ins style="font-weight: bold; text-decoration: none;"> |doi=10.1137/s0097539792231167</ins>}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Methods involving [[graph theory]] have been shown to have better asymptotic space complexity than the package-merge algorithm, but these have not seen as much practical application.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Methods involving [[graph theory]] have been shown to have better asymptotic space complexity than the package-merge algorithm, but these have not seen as much practical application.</div></td>
</tr>
</table>Rjwilmsihttps://en.wikipedia.org/w/index.php?title=Package-merge_algorithm&diff=704298021&oldid=prevMatthiaspaul: +red link2016-02-10T19:34:07Z<p>+red link</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:34, 10 February 2016</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Line 1:</td>
<td colspan="2" class="diff-lineno">Line 1:</td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''<del style="font-weight: bold; text-decoration: none;">'</del>coin collector's problem<del style="font-weight: bold; text-decoration: none;">'</del>''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464--473 |date=1990}}</ref></div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The '''package-merge algorithm''' is an ''[[Big O notation|O]](nL)''-time algorithm for finding an optimal [[length-limited Huffman code]] for a given distribution on a given alphabet of size ''n'', where no [[code word]] is longer than ''L''. It is a [[greedy algorithm]], and a generalization of [[Huffman coding|Huffman's original algorithm]]. Package-merge works by reducing the code construction problem to the binary ''<ins style="font-weight: bold; text-decoration: none;">[[</ins>coin collector's problem<ins style="font-weight: bold; text-decoration: none;">]]</ins>''.<ref name="LaHi">{{cite journal |first1=Lawrence L. |last1=Larmore |author-link1=Lawrence L. Larmore |first2=Daniel S. |last2=Hirschberg |author-link2=Daniel S. Hirschberg |title=A fast algorithm for optimal length-limited Huffman codes |journal=[[Journal of the Association for Computing Machinery]] |volume=37 |number=3 |pages=464--473 |date=1990}}</ref></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==The coin collector's problem==</div></td>
</tr>
</table>Matthiaspaul