 
Summary: Using Hirschberg's Algorithm to Generate Random Alignments of Strings.
Lloyd Allison,
Department of Computer Science,
Monash University,
Australia 3168.
email: lloyd@cs.monash.edu.au
submitted 1993, revised April 1994, accepted May 1994
Abstract. Hirschberg gave an alignment algorithm for the longest common subsequence problem that uses
O(n 2 ) time and O(n) space for two strings of length ”n. A simple modification of the algorithm can sample
string alignments at random according to their probability distribution. This is useful for statistical
estimation of evolutionary distances of a family of strings eg. DNA strings. The algorithm's time and space
complexity are unchanged.
Keywords: alignment, edit distance, Gibbs sampling, LCS, LCSS, Monte Carlo method, random.
Inf. Proc. Lett. 51 251255 1994
1994 Generating Random Alignments. 2
1. Introduction.
An optimal alignment algorithm returns an optimal way of relating two strings according to some
criterion. In some situations it is natural to model the differences between strings, or the "noise" in strings,
or both, as being due to a random process. This paper describes a method of sampling not optimal but
