Generating words in a context-free language uniformly at random

HG Mairson - Information Processing Letters, 1994 - Elsevier
Given an unambiguous context-free grammar G and an integer n> 0, we give two algorithms
for generating words derived from the grammar uniformly at random (uar). The first algorithm
generates a word uar in O (n 2) time using a data structure of size O (n). The second
algorithm generates a word uar in O (n) time using a data structure of size O (n 2). Both
algorithms make use of a preprocessing stage, where a data structure is built to facilitate the
later generation of words uniformly at random. The algorithms are analyzed in a unit-cost …
Showing the best result for this search. See all results