English

Non-redundant random generation algorithms for weighted context-free languages

Formal Languages and Automata Theory 2012-11-05 v1 Discrete Mathematics Data Structures and Algorithms

Abstract

We address the non-redundant random generation of kk words of length nn in a context-free language. Additionally, we want to avoid a predefined set of words. We study a rejection-based approach, whose worst-case time complexity is shown to grow exponentially with kk for some specifications and in the limit case of a coupon collector. We propose two algorithms respectively based on the recursive method and on an unranking approach. We show how careful implementations of these algorithms allow for a non-redundant generation of kk words of length nn in O(knlogn)\mathcal{O}(k\cdot n\cdot \log{n}) arithmetic operations, after a precomputation of Θ(n)\Theta(n) numbers. The overall complexity is therefore dominated by the generation of kk words, and the non-redundancy comes at a negligible cost.

Keywords

Cite

@article{arxiv.1211.0303,
  title  = {Non-redundant random generation algorithms for weighted context-free languages},
  author = {Andy Lorenz and Yann Ponty},
  journal= {arXiv preprint arXiv:1211.0303},
  year   = {2012}
}

Comments

arXiv admin note: text overlap with arXiv:1012.4560

R2 v1 2026-06-21T22:31:50.092Z