Improved p-fast Trie: A Highly Efficient Prefix Matching Algorithm
2025-08-10
This article presents an improved p-fast trie data structure, a highly efficient algorithm for finding the longest matching prefix or nearest predecessor/successor of a query string in a set of strings. Compared to previous versions, this improved version is more concise and space-efficient. It uses a hash table to store each unique prefix and a bitmap to represent the possible next characters for each prefix, achieving O(log k) time complexity (where k is the key length). While predecessor searches might require more probes, its performance still surpasses traditional qp-tries.
(dotat.at)
Development
prefix matching