  We consider the distribution of the length of the longest subsequence
avoiding a given pattern in a random permutation of length n. The well-studied
case of a longest increasing subsequence corresponds to avoiding the pattern
21. We show that there is some constant c such that the mean value of this
length is asymptotic to twice the square root of c times n and that the
distribution of the length is tightly concentrated around its mean. We observe
some apparent connections between c and the Stanley-Wilf limit of the class of
permutations avoiding the given pattern.
