Abstract
In the partial alphabetic tree problem we are given a multiset of nonnegative weights W = w 1, . . . , w n , partitioned into k ≤ n blocks B 1, . . . , B k. We want to find a binary tree T where the elements of W resides in its leaves such that if we traverse the leaves from left to right then all leaves of B i precede all leaves of B j for every i < j. Furthermore among all such trees, T has to minimize ∑ in =1 wid(wi), where d(wi) is the depth of wiin T. The partial alphabetic tree problem generalizes the problem of finding a Huffman tree over T (there is only one block) and the problem of finding a minimum cost alphabetic tree over W ( each block consists of a single item). This fundamental problem arises when we want to find an optimal search tree over a set of items which may have equal keys and when we want to find an optimal binary code for a set of items with known frequencies, such that we have a lexicographic restriction for some of the codewords. Our main result is a pseudo-polynomial time algorithm that finds the optimal tree. Our algorithm runs in O(W sum/W min)2α log(W sum/W min)n 2) time where W sum= ∑ in =1 wi, W min= mini wi, and α = 1/log ∅ 1.44 1. I n particular the running time is polynomial in case the weights are bounded by a polynomial of n. To bound the running time of our algorithm we prove an upper bound of ⌊α log(W sum/W min) + 1⌋ on the depth of the optimal tree.
Our algorithm relies on a solution to what we call the layered Hu.- man forest problem which is of independent interest. In the layered Huffman forest problem we are given an unordered multiset of weights W = w 1, . . . , w n, and a multiset of integers D = d 1, . . . , d m. We look for a forest F with m trees, T 1, . . . , T m, where the weights in W correspond to the leaves of F, that minimizes ∑ in =1 widF(wi) where dF(wi) is the depth of wiin its tree plus dj if wi ∈ Tj. Our algorithm for this problem runs in O(kn 2) time.
∅ = √5+12 1.618 is the golden ratio
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
S. Abiteboul, H. Kaplan, and T. Milo. Compact labeling schemes for ancestor queries. In 12 th Annual ACM Symposium on Discrete Algorithms (SODA), pages 547–556, 2001.
J. Abrahams. Code and parse trees for lossless source encoding, 1997.
S. Alstrup, C. Gavoille, H. Kaplan, and T. Rauhe. Identifying nearest common ancestors in a distributed environment. unpublished manuscript, july 2001.
S. Alstrup and T. Rauhe. Improved labeling scheme for ancestor queries. In Proc. ACM-SIAM Symposium on Discrete Algorithms (SODA), (to appear) January 2002.
A.M. Garsia and M. L. Wachs. A new algorithm for minimum cost binary trees. SIAM J. Comput, 6(4):622–642, Dec 1977.
E.N. Gilbert and E. F. Moore. Variable-length binary encodings. Bell System Technical Journal, 38:933–967, July 1959.
T.C. Hu, D. J. Kleitman, and J. K. Tamaki. Binary trees optimum under various criteria. SIAM J. Appl. Math., 37(2):514–532, October 1979.
T.C. Hu and C. Tacker. Optimum computer search trees. SIAM J. Appl. Math., 21:514–532, 1971.
D.A. Huffman. A method for the construction of minimum-redundancy codes. In Proc IRE, 40, pages 1098–1101, 1952.
H. Kaplan, T. Milo, and R. Shabo. A comparison of labeling schemes for ancestor queries. In Proc. ACM-SIAM Symposium on Discrete Algorithms (SODA), (to appear) January 2002.
Marek Karpinski, Lawrence L. Larmore, and Wojciech Rytter. Correctness of constructing optimal alphabetic trees revisited. Theoretical Computer Science, 180(1/2-2):309–324, June 1997.
G.O.H. Katona and T.O.H. Nemetz. Huffman codes and self information. IEEE Trans. on Information Theory, IT-22(3):337–340, May 1976.
D. E. Knuth. Optimum binary search trees. Acta Infomatica, 1:14–25, 1971.
M. Thorup and U. Zwick. Compact routing schemes. In 13 th ACM Symposium on Parallel Algorithms and Architectures (SPAA), 2001.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Barkan, A., Kaplan, H. (2002). Partial Alphabetic Trees. In: Möhring, R., Raman, R. (eds) Algorithms — ESA 2002. ESA 2002. Lecture Notes in Computer Science, vol 2461. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45749-6_14
Download citation
DOI: https://doi.org/10.1007/3-540-45749-6_14
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-44180-9
Online ISBN: 978-3-540-45749-7
eBook Packages: Springer Book Archive