Partial alphabetic trees

Arye Barkan, Haim Kaplan

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review


In the partial alphabetic tree problem we are given a multiset of nonnegative weights W = {w1,…, wn}, partitioned into k≤n blocks B1,…, Bk. 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 B1 precede all leaves of Bj for every i<j.Furthermore among all such trees, T has to minimize ∑Ni=1 wid(wi), where d(wi) is the depth of wi in T. The partial alphabetic tree problem generalizes the problem of finding a Huffman tree over W (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 (formula presented) time where (formula presented). In particular the running time is polynomial in case the weights are bounded by a polynomial of n. To bound the running time of our algorithwe prove an upper bound of [αlog(Wsum/Wmin)+1] on the depth of the optimal tree. Our algorithm relies on a solution to what we call the layered Huffman forest problem which is of independent interest. In the layered Huffman forest problem we are given an unordered multiset of weights W = {w1,…, wn}, and a multiset of integers D = {d1,…, dm}.We look for a forest F with m trees, T1,…, Tm, where the weights in W correspond to the leaves of F, that minimizes ∑ ni=1 widF(wi) where dF (wi) is the depth of wi in its tree plus di wi € Ti. Our algorithm for this problem runs in O(kn2)time.

Original languageEnglish
Title of host publicationAlgorithms - ESA 2002 - 10th Annual European Symposium, Proceedings
EditorsRolf Möhring, Rajeev Raman
PublisherSpringer Verlag
Number of pages12
ISBN (Electronic)3540441808, 9783540441809
StatePublished - 2002
Event10th Annual European Symposium on Algorithms, ESA 2002 - Rome, Italy
Duration: 17 Sep 200221 Sep 2002

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference10th Annual European Symposium on Algorithms, ESA 2002


Dive into the research topics of 'Partial alphabetic trees'. Together they form a unique fingerprint.

Cite this