NP-Completeness for the Space-Optimality of Double-Array Tries

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Bannai, Hideo, Goto, Keisuke, Kanda, Shunsuke, Köppl, Dominik
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909131997184000
author Bannai, Hideo
Goto, Keisuke
Kanda, Shunsuke
Köppl, Dominik
author_facet Bannai, Hideo
Goto, Keisuke
Kanda, Shunsuke
Köppl, Dominik
contents Indexing a set of strings for prefix search or membership queries is a fundamental task with many applications such as information retrieval or database systems. A classic abstract data type for modelling such an index is a trie. Due to the fundamental nature of this problem, it has sparked much interest, leading to a variety of trie implementations with different characteristics. A trie implementation that has been well-used in practice is the double-array (trie) consisting of merely two integer arrays. While a traversal takes constant time per node visit, the needed space consumption in computer words can be as large as the product of the number of nodes and the alphabet size. Despite that several heuristics have been proposed on lowering the space requirements, we are unaware of any theoretical guarantees. In this paper, we study the decision problem whether there exists a double-array of a given size. To this end, we first draw a connection to the sparse matrix compression problem, which makes our problem NP-complete for alphabet sizes linear to the number of nodes. We further propose a reduction from the restricted directed Hamiltonian path problem, leading to NP-completeness even for logarithmic-sized alphabets.
format Preprint
id arxiv_https___arxiv_org_abs_2403_04951
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle NP-Completeness for the Space-Optimality of Double-Array Tries
Bannai, Hideo
Goto, Keisuke
Kanda, Shunsuke
Köppl, Dominik
Data Structures and Algorithms
Indexing a set of strings for prefix search or membership queries is a fundamental task with many applications such as information retrieval or database systems. A classic abstract data type for modelling such an index is a trie. Due to the fundamental nature of this problem, it has sparked much interest, leading to a variety of trie implementations with different characteristics. A trie implementation that has been well-used in practice is the double-array (trie) consisting of merely two integer arrays. While a traversal takes constant time per node visit, the needed space consumption in computer words can be as large as the product of the number of nodes and the alphabet size. Despite that several heuristics have been proposed on lowering the space requirements, we are unaware of any theoretical guarantees. In this paper, we study the decision problem whether there exists a double-array of a given size. To this end, we first draw a connection to the sparse matrix compression problem, which makes our problem NP-complete for alphabet sizes linear to the number of nodes. We further propose a reduction from the restricted directed Hamiltonian path problem, leading to NP-completeness even for logarithmic-sized alphabets.
title NP-Completeness for the Space-Optimality of Double-Array Tries
topic Data Structures and Algorithms
url https://arxiv.org/abs/2403.04951