## 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_{1} precede all leaves of B_{j} for every i<j.Furthermore among all such trees, T has to minimize ∑^{N}_{i}=1 w_{i}d(w_{i}), where d(w_{i}) is the depth of w_{i} 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(W_{sum}/W_{min})+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 = {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 ∑ ^{n}_{i=1} w_{i}d_{F}(w_{i}) where d_{F} (w_{i}) is the depth of w_{i} in its tree plus d_{i} w_{i} € T_{i}. Our algorithm for this problem runs in O(kn^{2})time.

Original language | English |
---|---|

Title of host publication | Algorithms - ESA 2002 - 10th Annual European Symposium, Proceedings |

Editors | Rolf Möhring, Rajeev Raman |

Publisher | Springer Verlag |

Pages | 114-125 |

Number of pages | 12 |

ISBN (Electronic) | 3540441808, 9783540441809 |

DOIs | |

State | Published - 2002 |

Event | 10th Annual European Symposium on Algorithms, ESA 2002 - Rome, Italy Duration: 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) |
---|---|

Volume | 2461 |

ISSN (Print) | 0302-9743 |

ISSN (Electronic) | 1611-3349 |

### Conference

Conference | 10th Annual European Symposium on Algorithms, ESA 2002 |
---|---|

Country/Territory | Italy |

City | Rome |

Period | 17/09/02 → 21/09/02 |