# Partial alphabetic trees

Arye Barkan, Haim Kaplan

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

## Abstract

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 language English Algorithms - ESA 2002 - 10th Annual European Symposium, Proceedings Rolf Möhring, Rajeev Raman Springer Verlag 114-125 12 3540441808, 9783540441809 https://doi.org/10.1007/3-540-45749-6_14 Published - 2002 10th Annual European Symposium on Algorithms, ESA 2002 - Rome, ItalyDuration: 17 Sep 2002 → 21 Sep 2002

### Publication series

Name Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) 2461 0302-9743 1611-3349

### Conference

Conference 10th Annual European Symposium on Algorithms, ESA 2002 Italy Rome 17/09/02 → 21/09/02

## Fingerprint

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