PROFILES OF TRIES 1. Introduction. Tries are prototype data

Report 2 Downloads 61 Views
SIAM J. COMPUT. Vol. 38, No. 5, pp. 1821–1880

c 2009 Society for Industrial and Applied Mathematics 

PROFILES OF TRIES∗ § , AND ` GAHYUN PARK† , HSIEN-KUEI HWANG‡ , PIERRE NICODEME

WOJCIECH SZPANKOWSKI¶ Abstract. Tries (from retrieval) are one of the most popular data structures on words. They are pertinent to the (internal) structure of stored words and several splitting procedures used in diverse contexts. The profile of a trie is a parameter that represents the number of nodes (either internal or external) with the same distance from the root. It is a function of the number of strings stored in a trie and the distance from the root. Several, if not all, trie parameters such as height, size, depth, shortest path, and fill-up level can be uniformly analyzed through the (external and internal) profiles. Although profiles represent one of the most fundamental parameters of tries, they have hardly been studied in the past. The analysis of profiles is surprisingly arduous, but once it is carried out it reveals unusually intriguing and interesting behavior. We present a detailed study of the distribution of the profiles in a trie built over random strings generated by a memoryless source. We first derive recurrences satisfied by the expected profiles and solve them asymptotically for all possible ranges of the distance from the root. It appears that profiles of tries exhibit several fascinating phenomena. When moving from the root to the leaves of a trie, the growth of the expected profiles varies. Near the root, the external profiles tend to zero at an exponential rate, and then the rate gradually rises to being logarithmic; the external profiles then abruptly tend to infinity, first logarithmically and then polynomially; they then tend polynomially to zero again. Furthermore, the expected profiles of asymmetric tries are oscillating in a range where profiles grow polynomially, while symmetric tries are nonoscillating, in contrast to most shape parameters of random tries studied previously. Such a periodic behavior for asymmetric tries implies that the depth satisfies a central limit theorem but not a local limit theorem of the usual form. Also √the widest levels in symmetric tries contain a linear number of nodes, differing from the order n/ log n for asymmetric tries, n being the size of the trees. Finally, it is observed that profiles satisfy central limit theorems when the variance goes unbounded, while near the height they are distributed according to Poisson laws. As a consequence of these results we find typical behaviors of the height, shortest path, fill-up level, and depth. These results are derived here by methods of analytic algorithmics such as generating functions, Mellin transform, Poissonization and de-Poissonization, the saddle-point method, singularity analysis, and uniform asymptotic analysis. Key words. digital trees, tries, profile, depth, height, shortest path, fill-up level, analytic Poissonization, Mellin transform, saddle-point method, singularity analysis AMS subject classifications. Primary, 68W40; Secondary, 68P5, 68P10, 05C05, 60F05 DOI. 10.1137/070685531

1. Introduction. Tries are prototype data structures useful for many indexing and retrieval purposes. They were first proposed by de la Briandais [9] in the late 1950s for information processing; Fredkin [27] suggested the current name as it is ∗ Received by the editors March 19, 2007; accepted for publication (in revised form) August 19, 2008; published electronically January 9, 2009. http://www.siam.org/journals/sicomp/38-5/68553.html † Department of Computer Science, State University of New York at Geneseo, Geneseo, NY 14454 ([email protected]). ‡ Institute of Statistical Science, Academia Sinica, 11529 Taipei, Taiwan ([email protected]. edu.tw). This author’s work was partially supported by a grant from the National Science Council of Taiwan. § Laboratory LIX, Ecole ´ Polytechnique, 91128 Palaiseau Cedex, France (nicodeme@lix. polytechnique.fr). ¶ Department of Computer Sciences, Purdue University, 250 N. University Street, West Lafayette, IN 47907-2066 ([email protected]). This author’s work was supported in part by NSF grants CCF0513636, DMS-0503742, DMS-0800568, and CCF-0830140; NIH grant R01 GM068959-01; NSA grant H98230-08-1-0092; and AFOSR grant FA8655-08-1-3018.

1821

1822

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

part of retrieval. Tries are multiway trees whose nodes are vectors of characters or digits. Due to their simplicity and efficiency, tries found widespread use in diverse applications including document taxonomy, IP address lookup, data compression, dynamic hashing, partial-match queries, speech recognition, leader election algorithms, and distributed hashing tables (see [29, 50, 53, 79]). In this paper, we are concerned with probabilistic properties of the profiles of tries, where the profile of a tree is the sequence of numbers each corresponding to the number of nodes with the same distance from the root. We discover several new phenomena in the profiles of tries built over strings generated by a random memoryless source, and develop asymptotic tools to describe them. Structure and usefulness of tries. Tries are a natural choice of data structure when the input records involve a notion of alphabets or digits. They are often used to store such data so that future retrieval can be made efficient. Given a sequence of n words over the alphabet {a1 , . . . , am }, m ≥ 2, we can construct a trie as follows. If n = 0, then the trie is empty. If n = 1, then a single (external) node holding the word is allocated. If n ≥ 1, then the trie consists of a root (internal) node directing words to the m subtrees according to the first alphabet of each word, and words directed to the same subtree are themselves tries (see [50, 53, 79] for more details). For simplicity, we deal only with binary tries in this paper. Unlike other search trees such as digital search trees and binary search trees where records or keys are stored at the internal nodes, the internal nodes in tries are branching nodes used merely to direct records to each subtrie, with all records stored in external nodes that are leaves of such tries. A trie has more internal nodes than external nodes (fixed to be n throughout this paper), differing from almost all other search trees. In Figure 1 we plot a binary trie of five strings. The simple organizing procedure used to construct tries and the general efficiency they achieve make tries one of the most popular digital search trees. Since their invention, tries have found frequent use in many computer science applications. For example, tries are widely used in algorithms for automatically correcting words in texts (see [51]) and in algorithms for taxonomies and toolkits of regular language (see the Ph.D. thesis [80]); they are also used to represent the event history in datarace detection for multithreaded object-oriented programs (see [6]); another example is the Internet IP address lookup problem (see [60, 74]), where the search time for the IP address problem is directly related to the distribution of the fill-up level (see below for a more precise definition) and other trie parameters. For applications to other problems in searching, sorting, dynamic hashing, coding, polynomial factorization, Lempel–Ziv compression schemes, and molecular biology, see [29, 79]. The structure of tries also has a close connection to several splitting procedures using coin-flipping; these include algorithms for resolving collisions in multiaccess (or broadcast) communication models, algorithms for loser selection or leader election, etc.; see [45]. Thus most shape parameters in tries have direct interpretations in terms of other related objects. Random tries under the Bernoulli model. Throughout the paper, we write Bn,k to denote the number of external nodes (leaves) at distance k from the root; the number of internal nodes at distance k from the root is denoted by In,k . For simplicity, we will refer to Bn,k as the external profile and In,k as the internal profile. Figure 1 shows a trie and its profiles. In this paper we study the profiles of a trie built over n binary strings generated by a memoryless source. More precisely, we assume that the input is a sequence of n independent and identically distributed random variables, each being composed of an

1823

PROFILE OF TRIES

Bn,0 = 0, In,0 = 1 1

0

Bn,1 = 0, In,1 = 2 0

0

1 Bn,2 = 1, In,2 = 2

10 0

0

110 0 0000

1 111

Bn,3 = 2, In,3 = 1

1 0001

Bn,4 = 2, In,4 = 0

Fig. 1. A trie of n = 5 records and its profiles: the circles represent internal nodes, and rectangles holding the records are external nodes.

infinite sequence of Bernoulli random variables with mean p, where 0 < p < 1 is the probability of a “1” and q := 1 − p is the probability of a “0.” The corresponding trie constructed from these n binary strings is called a random trie. This simple model may seem too idealized for practical purposes; however, the typical behaviors under such a model often hold under more general models such as Markovian or dynamical sources, although the technicalities are usually more involved (see, for example, [8, 12, 15, 35]). The motivation of studying the profiles is multifold. First, they are fine shape measures closely connected to many other cost measures on tries; some of them are indicated below. Second, they are also asymptotically close to the profiles of suffix trees, which in turn have a direct combinatorial interpretation in terms of words; see [36, 59, 78, 79] for more information and another interpretation in terms of urn models. Third, not only are the analytic problems mathematically challenging, but the diverse new phenomena they exhibit are highly interesting and unusual. Fourth, our findings imply several new results on other shape parameters (see section 8). Finally, most properties of random tries have also a prototype character and are expected to hold for other varieties of digital search trees (and under more general random models), although the proofs are generally more complicated. Major cost measures on random tries. Due to the usefulness of tries, many cost measures, discussed below, on random tries have been studied in the literature since the early 1970s, and most of these measures can be expressed and analyzed through the profiles studied in this paper: • depth: the distance from the root to a randomly selected node; its distribution is given by the expected external profile divided by n; see [10, 12, 13, 20, 24, 33, 36, 42, 46, 52, 65, 69, 71, 75, 76]; • total path length: the sum of distances between nodes and the root, or, equivalently, j jIn,j ; see [8, 11, 24, 44, 58, 57, 70,  71, 72, 73, 75]; • size: the total number of internal nodes, or j In,j ; see [8, 24, 34, 36, 40, 41, 43, 47, 50, 57, 67, 68, 69, 70, 71, 72, 73]; • height : the length of the longest path from the root, or max{j : Bn,j > 0}; see [8, 11, 12, 13, 14, 22, 26, 33, 48, 64, 65, 77]; • shortest path: the length of the shortest path from the root to an external node, or min{j : Bn,j > 0}; see [64, 65];

1824

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

• fill-up (or saturation) level : the largest full level, or max{j : In,j = 2j }, where the levels of a tree denote the sets of nodes with the same distance from the root; see [49]; • Horton–Strahler number and stack-size: certain notions of heights related to the traversal of tries; see [4, 17, 54, 55, 56]; • distance of two randomly chosen nodes; see [1, 7]; • pattern occurrences in tries (including page usage or b-tries); see [22, 42, 43, 58, 71, 76]; • one-sided height (or leader election or loser selection); see [21, 39, 66, 81, 82]. The reader is referred to the book [79] and the papers [15, 37, 71] for a systematic treatment of several of these quantities. The general analytic context. The major difference between most previous study and the current paper is that we are dealing with the asymptotics of bivariate recurrence, in contrast to univariate recurrences (with or without maximization or minimization) addressed in the literature. To be more precise, we observe that, by assumption of the model, the probability generating function Pn,k (y) := E(y Bn,k ) of the external profile satisfies the recurrence  n Pn,k (y) = (1) (n ≥ 2; k ≥ 1) pj q n−j Pj,k−1 (y)Pn−j,k−1 (y) j 0≤j≤n

with the initial conditions Pn,k (y) = 1 + δn,1 δk,0 (y − 1) when either n ≤ 1 and k ≥ 0 or k = 0 and n ≥ 0, where δa,b is the Kronecker symbol. Observe that this recurrence depends on two parameters n and k, which makes the analysis quite challenging, as we will demonstrate in this paper. The probability generating functions of the internal profile satisfy the same recurrence (1) but with different initial conditions; see section 6. From (1), the moments of Bn,k and In,k (centered or not) are seen to satisfy a recurrence of the form  n pj q n−j (xj,k−1 + xn−j,k−1 ) xn,k = an,k + j 0≤j≤n

with suitable initial conditions, where an,k are known (either explicitly or inductively). approach is to consider the Poisson generating function f˜k (z) :=  A standard −z n e n xn,k z /n!, which in turn satisfies the functional equation f˜k (z) = g˜k (z) + f˜k−1 (pz) + f˜k−1 (qz) with a suitable g˜k (z). This equation can be solved explicitly by a simple iteration argument and asymptotically by using the Mellin transform (see [23, 79]). The final step is to invert from the asymptotics of the Poisson generating function f˜k (z) to recover the asymptotics of xn,k . This last step is guided by the Poisson heuristic, which roughly states that  (2) if a sequence {xn }n is “smooth enough,” then xn ∼ e−n j≥0 xj nj /j!, where xn ∼ yn if limn→∞ xn /yn = 1. Such a Poisson heuristic has appeared in diverse contexts under different forms such as Borel summability and Tauberian theorems; it dates back at least to Ramanujan’s Notebooks; see the book by Berndt [3, pp. 57–66] for more details. It is known as analytic de-Poissonization when justified

PROFILE OF TRIES

1825

by complex analysis and the saddle-point method, and was the subject of intensive analysis, resulting in a robust solution presented in [37].  By means of the Poisson heuristic (2), we expect that μn,k ∼ e−n j≥0 μj,k nj /j!. However, as we will see, such a heuristic holds in our case when q 2k n → 0 but fails otherwise. The reason is that μn,k is too small in this range. Also it should be mentioned that the asymptotic analysis of the above functional equation is in general more intricate because we have an additional parameter k to be taken into account and we need uniformity for our asymptotic approximations in k (varying with n) and in z (in some region in the complex plane) in order to invert the results to obtain xn,k by suitable complex analysis. Known results for profiles. As far as probabilistic properties of the profiles of random tries are concerned, very little is known in the literature. Since the distribution of the depth Dn in random tries is given by P(Dn = k) = μn,k /n, where μn,k := E(Bn,k ), the asymptotics of the expected profile μn,k for n → ∞ and varying k = k(n) can be regarded as local limit theorems for Dn . Although many papers have addressed the limiting behaviors of the depth, none has dealt with the local limit theorem of Dn and the asymptotics of μn,k for varying k. We will see in section 8 that our result implies an unusual type of local limit theorem for Dn . However, it should be mentioned that the central limit theorem for the depth was developed in [13, 34, 35]. On the other hand, Pittel [65] showed that the distribution of the number of pairs of input-strings having a common prefix of length at least k is asymptotically Poisson when k is close to the height. Devroye [14] showed that if

E(Bn,k ) √ → ∞, n

if E(In,k ) → ∞,

then then

Bn,k → 1 in probability; E(Bn,k ) In,k → 1 in probability, E(In,k )

under very general assumptions on the underlying models (see also [15] for further refinements). References [65] and [14] represent known results concerning profiles. We will see that convergence in probability in the two “if statements” holds as long as the variance tends to infinity. Sketch of the major phenomena. In the next section we present an in-depth discussion of our results. Here, we briefly summarize our main findings. We focus mostly on the profiles of asymmetric tries (when p = q) since the symmetric tries (when p = q = 1/2) are comparatively easier. We will first derive asymptotic approximations to the average external profile μn,k for all ranges of k. Our results show inter alia that for k ≤ (1 − ε) log n/ log(1/q) the average profile μn,k is exponentially small where ε > 0 is small. When k increases and lies in the range (log n − log log log n + O(1))/ log(1/q), then μn,k decays to zero logarithmically until k > k ∗ for a specific threshold k ∗ in this range beyond which μn,k suddenly grows unbounded at a logarithmic rate. The rate becomes polynomial Θ(nυ ) for some 0 < υ ≤ 1 when 2 1 (1 + ε) log n ≤ k ≤ (1 − ε) log n. log(1/q) log(1/(p2 + q 2 )) Surprisingly enough, for this range of k an oscillating √ factor emerges in the expected profile behavior; that is, E(Bn,k ) ≈ G(logp/q pk n)nv / log n, where G is a bounded periodic function. Such behavior is a consequence of an infinite number of saddlepoints appearing in the integrand of the associated Mellin integral transform. This

1826

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

was first observed by Nicod`eme [59]. For larger values of k, these oscillations disappear since the behavior of the expected profile is dominated by a polar singularity. Analogous results also hold for the internal profile. In addition, we prove that the variances of both profiles are asymptotically of the same order as their expected values. This suggests a central limit theorem for both external and internal profiles for a wide range of k. We show that this is indeed true; furthermore, we also show that for k near the height the limiting distribution of the profiles becomes Poisson. Some of these results were already anticipated in [63] and constitute the Ph.D. thesis of the first author [62]. Profiles of digital and nondigital log trees. In passing, we observe that most random trees in the discrete probability literature fall into two major categories according √ to their expected height being of order n (referred to as square-root trees for brevity) or of order log n (referred to as log trees), where n is the tree size. While most random square-root trees were introduced in combinatorics and probability, the majority of log trees arise from data structures and computer algorithms. We can further classify log trees into “digital-type” and “nondigital-type” log trees, according to the nature of construction (or search) of the tree. Profiles of nondigital-type search trees of logarithmic height for which binary search trees are representative have received much recent attention and are shown to exhibit several interesting phenomena such as bimodality of the variance and multifaceted behaviors of the limiting distributions; see [5, 18, 19, 28, 31] for more information. In contrast, profiles of digital-type search trees have not been addressed as much, and most properties remain unknown; see [14, 15, 65] for tries and [2, 38] for digital search trees. We will show that the limiting behaviors of the profiles are very different from those of nondigital search trees. In particular, while in no range will the normalized profiles in random binary search trees lead to asymptotic normality (in the sense of convergence in distribution), profiles of random tries, when properly centered and normalized, all converge to the standard normal law when the variance goes unbounded in the limit. As is often the case for proving asymptotic normality, we need more precise asymptotic approximation to the variance, rendering our analysis more complicated. Organization of the paper. The paper is organized as follows. In the next section, we present (rather informally) a more detailed summary of our main findings. This section is to help the reader to comprehend the richness of our results in their fullness but without resorting to rather abstruse mathematical formulations. Sections 3–8 are devoted to precise formulations of our results. This paper contains two major parts: The first, section 3, develops the asymptotic tools we need for deriving the diverse asymptotic approximations to the expected external profile μn,k . Most proofs of the second part (sections 4–8) are then sketched because they extend the same methods of proof as in the first part. Except for sections 7 and 8, we assume p = q throughout this paper. Among these sections, section 4 derives the asymptotics of the variance of Bn,k , the corresponding results of convergence in distribution being given in section 5. The internal profiles are addressed in section 6, and results for symmetric tries are given in section 7. Consequences of our findings are discussed in section 8, where we establish typical behaviors of the height, the width, the shortest path, the fill-up level, and the right-profile, as well as a rather atypical local limit theorem for the depth. 2. Summary of main results. In this section we discuss informally our main results. We focus here on describing the major phenomena arising in the analysis of

1827

PROFILE OF TRIES

profiles rather than presenting the precise and complicated results to which we devote the remaining sections of this paper. Crucial to our analysis of the profiles is the asymptotics of the expected profiles. Not only are the results fundamental and highly interesting, but the analytic methods we used are also of certain generality. From (1), we see that the expected external profile μn,k := E(Bn,k ) satisfies the following recurrence:  n (3) μn,k = pj q n−j (μj,k−1 + μn−j,k−1 ) j 0≤j≤n

for n ≥ 2 and k ≥ 1 with the initial values μn,0 = 0 for all n = 1 and 1 for n = 1. Furthermore, μ0,k = 0, k ≥ 0, and μ1,k = 0 for k ≥ 1 and is equal to 1 when k = 0. Throughout we assume that p > q = 1 − p unless stated otherwise. The polynomial growth of μn,k . In section 3, we solve asymptotically (3) for various ranges of k when p = q; a crude description of the asymptotics of μn,k is as follows: ⎧ 0 if α ≤ α1 , ⎪ ⎪ ⎨ log μn,k −ρ + α log(p−ρ + q −ρ ) if α1 ≤ α ≤ α2 , → (4) if α2 ≤ α ≤ α3 , 2 + α log(p2 + q 2 ) ⎪ log n ⎪ ⎩ 0 if α ≥ α3 , where (5) α1 :=

1 , log(1/q)

α2 :=

p2 + q 2 , p2 log(1/p) + q 2 log(1/q)

and α3 :=

2 log(1/(p2 + q 2 ))

are delimiters of α := limn k/ log n (k = k(n)), and ρ :=

1 log log(p/q)



1 − α log(1/p) α log(1/q) − 1

 .

Note that α1 ≤ α2 ; see Figure 2. The limiting estimate (4) gives a rough picture of μn,k as follows: μn,k is of polynomial growth rate when α1 + ε ≤ α ≤ α3 − ε and is smaller than any polynomial powers when 0 ≤ α ≤ α1 − ε and α ≥ α3 + ε. Near the two boundaries α1 and α3 , the behaviors of μn,k will undergo phase changes from being subpolynomial to being polynomial or the other way around. More refined asymptotics. To derive more precise asymptotics of μn,k than the phase transitions (4) of the polynomial order of μn,k , we divide all possible values of k into four overlapping ranges. (I) Elementary range: 1 ≤ k ≤ α1 (log n − log log log n + O(1)). √ (II) Saddle-point range: α1 (log n−log log log n+Kn ) ≤ k ≤ α2 (log n−Kn log n). (III) Gaussian transitional range: k = α2 log n +√o((log n)2/3 ). (IV) Polar singularity range: k ≥ α2 log n + Kn log n, where, throughout this paper, Kn ≥ 1 represents a (generic) sequence tending to infinity. More precisely, in Theorem 1 we prove that for k lying in range (I) the expected external profile μn,k first decays exponentially fast (asymptotic to q k n(1 − q k )n−1 ).

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

1828

10

α3

1

8

α2

0.8 p = 0.85

0.6

6

p = 0.9

4

0.4

2

0.2

0.5

0.6

0.7

0.8

α1 p 0.9 1

α2

0

2

4

6

8

10

Fig. 2. Left: a plot of α1 , α2 , and α3 (defined in (5)) as functions of p. Right: the (nonzero) limiting order of log μn,k / log n plotted against α = limn k/ log n for p = 0.55, 0.6, . . . , 0.9 (the spans of the curves increase as p grows). The vertical lines represent the positions of α2 (to the right of which the curves are straight lines); see (4).

Then, when k is around α1 (log n − log log log n + log(p/q − 1) + m log(p/q)) for some integer m ≥ 0, μn,k ∼

k m m k−m −npm qk−m p q ne , m!

which is of order  μn,k = O

log log n



logξ−m n

for some ξ. Thus, for m < ξ the expected external profile decays only logarithmically, but for m ≥ ξ it increases logarithmically. The behavior of μn,k in range (II) is described in Theorem 2. The situation becomes highly nontrivial and interesting. More precisely, for α1 (1 + ε) log n ≤ k ≤ α2 (1 − ε) log n, we find that

pρ q ρ (p−ρ + q −ρ ) nυ1 , μn,k ∼ G1 ρ; logp/q pk n ·√ log n 2παn,k log(p/q) where (αn,k := k/ log n) υ1 = −ρ + αn,k log(p−ρ + q −ρ ),   −1 − αn,k log q 1 ρ=− log , log(p/q) 1 + αn,k log p and G1 (ρ; x) is a periodic function. We plot in Figures 3 and 4 the periodic parts of G1 (−1, x) for a few values of p and ρ, respectively. Analytically, these oscillations are consequences of an infinite number of saddle-points appearing in the integrand of the associated Mellin transform of the expected profile, but visually they look like certain sine waves due to the fact that the corresponding Fourier expansions involve a

1829

PROFILE OF TRIES 6 × 10−23

3 × 10−7

6 × 10−3 p = 0.95

p = 0.65 1 p = 0.55 −6 × 10−23

p = 0.85 1

1

−3 × 10−7

p = 0.75

−6 × 10−3

Fig. 3. The fluctuating part around the mean of the periodic function G1 (−1; x) for p = 0.55, 0.65, . . . , 0.95 and for x in the unit interval; its amplitude tends to zero when p → 0.5+ . 1.5 × 10−11

ρ = −1.5

3 × 10−6

ρ = 3.5

1

1.5 × 10−11

10

1

1

3 × 10−6

ρ = 8.5

−10

Fig. 4. The fluctuating part around the mean of the periodic function G1 (ρ; x) for ρ ∈ {−1.5, 3.5, 8.5} and x ∈ [0, 1]. The amplitude increases as ρ grows.

Gamma function with increasing parameters, which decreases very fast along a fixed vertical line for an increasing imaginary part, so that only a few terms dominate. Finally, in Theorem 3 we prove that for k in range (IV) μn,k ∼ 2pqn2 (p2 + q 2 )k−1 =

2pq nυ2 , p2 + q 2

where υ2 = 2 + αn,k log(p2 + q 2 ), and the periodic function disappears. In this region, the asymptotic behavior of the expected profile is dictated by the expected number of pairs (of input-strings) having common prefixes of length at least k. This property is analytically reflected by a polar singularity in the associated Mellin transform. The asymptotics of μn,k in range (III) for k = α2 log n + o(log2/3 n) are presented in Theorem 4. In this transitional range, the saddle-point coalesces with the polar singularity, so we use the Gaussian integral to describe the behavior of μn,k . In summary, our results roughly state that μn,k → 0 when 1 ≤ k ≤ k ∗ for some ∗ k close to α1 (log n − log log log n + O(1)), and then μn,k tends abruptly to infinity at a logarithmic rate when k > k ∗ . Such an abrupt change has already been observed in the literature for the shortest path and the fill-up level (see [49, 65]), but not much is known for μn,k beyond that. Then we show that μn,k grows polynomially when k lies in the range α1 (1 + ε) log n ≤ k ≤ α3 (1 − ε) log n, reaching the peak where it is √ of order n/ log n; it decays at a slower rate afterwards until it tends to zero again when k ≥ α3 (log n + Kn ). A salient feature here is the presence of an oscillating function in the asymptotic approximation when p = q.1 In Figure 5, a plot of the rough silhouettes of μn,k is presented. 1 The expected values of many shape characteristics of random tries often exhibit the asymptotic pattern: ∼ F (logc n)n if log p/ log q is rational for some periodic function F and constant c expressible in terms of p, and ∼ Cn if log p/ log q is irrational; see [37, 71, 79].

1830

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

α1 log

n log log n

+ O(1)

α1 log

n log log n

+ O(1)

α0 log n log n+O(1) p log(1/p)+q log(1/q)

α2 log n

α3 log n + O(1)

log n+O(1) p log(1/p)+q log(1/q)

α2 log n

α3 log n + O(1)

Fig. 5. The silhouettes of the expected external (left) and internal (right) profiles of an asymmetric trie (p = 0.75). Note that the right subtrees of the asymmetric trie have more nodes than their left siblings since p > 1/2. Also, the first few levels contain almost no external nodes but are almost full of internal nodes.

Asymptotics of the expected internal profile. The expected value of the internal profile E(In,k ) is discussed in section 6. In particular, √ the expected internal profile is asymptotically equivalent to 2k for k ≤ α (log n−K log n), where α0 := 2/(log(1/p) 0 n √ + log(1/q)). When k ≥ α2 (log n + Kn log n), then E(In,k ) ∼ (p2 + q 2 )E(Bn,k )/pq. Between these two ranges, it is again the infinite number of saddle-points that yield the dominant asymptotic approximation. Unlike μn,k , an additional √ phase transition appears in the asymptotics of the E(In,k ) when k = α0 log n + O( log n), reflecting the structural change of the internal nodes from being asymptotically full to being of the same order as the number of external nodes. The silhouettes of the expected internal profiles for a symmetric trie and an asymmetric (p = 0.75) trie are presented in Figure 6. Variance and limiting distributions. In section 4 we deal with the variance of the profile. In particular, in Theorem 7 we derive asymptotic approximations to the variance of the profile, which asymptotically turns out to be of the same order as the expected value for all ranges of k ≥ 1; namely, V(Bn,k ) = Θ(E(Bn,k )). In fact, we show that V(Bn,k ) ∼ E(Bn,k ) in range (I), for range (IV) V(Bn,k ) ∼ 2E(Bn,k ), and in range (II) (polynomial growth) the variance and the expected profile differ only by the oscillating functions. The variance of the internal profile behaves almost identically to the variance of the external profile; roughly, V(In,k ) = Θ(V(Bn,k )) for all k. The methods used to derive these results are the same as those used in section 3. We then prove, in section 5, that both internal and external profiles, after proper normalization, are asymptotically normally distributed iff the variance tends to infinity (see Theorems 8 and 9). The limiting distribution is Poisson when the variance

1831

PROFILE OF TRIES

log2

n log n

+ O(1) log2

n log n

+ O(1)

log2 n + O(1)

log2 n + O(1)

2 log2 n + O(1)

2 log2 n + O(1)

Fig. 6. The silhouettes of the expected external and internal profiles of a symmetric; compare Figure 5.

remains bounded away from zero and infinity. In particular, we will prove that when V(Bn,k ) = Θ(1), P (Bn,k = 2m) =

λm 0 e−λ0 + o(1) and P (Bn,k = 2m + 1) = o(1), m!

where λ0 := pqn2 (p2 + q 2 )k−1 , while for V(In,k ) = Θ(1), we find P(In,k = m) =

λm 1 e−λ1 + o(1) m!

(m = 0, 1, . . . ),

where λ1 := n2 (p2 + q 2 )k /2. These results hold for both symmetric and asymmetric tries, but the ranges where the variances become unbounded are different. Symmetric tries. For the symmetric case, we have α1 = α2 = 1/ log 2. This means that the two ranges separated by α2 coalesce into one for symmetric tries; see Figure 2. The analysis then becomes simpler as shown in section 7. An interesting property is that unlike for asymmetric tries, the fattest levels of profiles of symmetric tries contain a linear number of nodes. The global picture of a random symmetric trie is roughly as follows (α1 = 1/ log 2): • When 1 ≤ k ≤ α1 (log n − log log n + O((log n)−1 )), each level is almost full of internal nodes (In,k ≈ 2k ), the number of external nodes tending to zero; in particular, the variances of both profiles tend to zero. • When α1 (log n − log log n + Kn / log n) ≤ k ≤ 2α1 (log n − Kn ), where Kn is any sequence tending to infinity, the variances of both profiles tend to infinity, and we prove the asymptotic normality of both profiles. • When k = 2α1 (log n + O(1)), both profiles are asymptotically Poisson distributed, but Bn,k assumes only even values. • When k ≥ α1 (log n + Kn ), then nodes appear very unlikely. Section 8 describes some consequences of our main results. In particular, we point out a rather unusual form of the local limit theorem for the depth due to the oscillating factor in the expected profile. Then we apply our results to rederive typical behavior for the height, the shortest path, and the fill-up level. Also, the width and

1832

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

the right-profile (counting only right branches and neglecting the left ones) are briefly discussed. This completes the summary of our main results. Precise formulations and proofs are presented in the next five sections. Enjoy the reading! 3. Expected external profile. We derive asymptotic approximations to the expected external profile μn,k in this section, starting with a few useful expressions for μn,k . Notation. Throughout this paper, p ∈ [1/2, 1) is fixed and q = 1−p. Let k = k(n) and α := limn k/ log n, whenever the limit exists. The constants α1 , α2 , and α3 are defined in (5). For convenience, we also write Ln := log n,

LLn := log log n,

LLLn := log log log n.

The generic symbol ε is always used to represent a suitably small constant whose value may vary from one occurrence to another, and Kn denotes any sequence tending to infinity. The symbol f (n) = Θ(g(n)) means that there are positive constants C and C  such that C|g(n)| ≤ |f (n)| ≤ C  |g(n)|. 3.1. Exact expressions and  integral representations. ˜Denote by Mk (z) the probability generating function n≥0 μn,k z n /n! of μn,k and by M k (z) the correspond−z ˜ ing Poisson generating function Mk (z) := e Mk (z). ˜ k (z) satisfies the integral represenLemma 1. The Poisson generating function M tation

k  ˜ k (z) = 1 (6) z −s Γ(s + 1)g(s) p−s + q −s ds M 2πi (ρ) for k ≥ 1 and (z) > 0, where Γ denotes the Gamma function, g(s) := 1 − 1/(p−s +   ρ+i∞ q −s ), and (ρ) stands for the integral ρ−i∞ . The integral with ρ > −2 is absolutely convergent for (z) > 0. Proof. By taking the derivative with respect to y on both sides of (1) and then substituting y = 1, we see that μn,k satisfies the recurrence (3) with the initial conditions μn,k = δn,1 δk,0 when either n ≤ 1 and k ≥ 0 or k = 0 and n ≥ 0. Note that   μn,1 = n pq n−1 + qpn−1 (n ≥ 2). It follows that Mk (z) = eqz Mk−1 (pz) + epz Mk−1 (qz)

(k ≥ 2),

˜ k (z) satisfies with M1 (z) = z(peqz + qepz − 1). Thus M (7)

˜ k (z) = M ˜ k−1 (pz) + M ˜ k−1 (qz). M

Iterating this equation yields (8)

˜ k (z) = M

 k − 1 ˜ 1 (pj q k−1−j z), M j

0≤j −2, and the Mellin transform of M1 (pj q k−1−j z) is p−sj q −s(k−1−j) M1∗ (s) (see [23, 79]). To justify the absolute convergence of the integral, we apply the Stirling formula for the Gamma function (with complex parameter)

s s  √   1 + O |s|−1 , Γ(s + 1) = 2πs e uniformly as |s| → ∞ and | arg s| ≤ π − ε, which implies that |Γ(ρ + it)| = Θ(|t|ρ−1/2 e−π|t|/2 ),

(9)

uniformly for |t| → ∞ and ρ = o(|t|2/3 ). The integrand in (6) is analytic for (s) > −2 and bounded above by  k z −ρ−it Γ(ρ + 1 + it)g(ρ + it) p−ρ−it + q −ρ−it

= O |z|−ρ |t|ρ+1/2 e−π|t|/2+arg(z)t (p−ρ + q −ρ )k for large |t|. This completes the proof of the lemma. Corollary 1. The expected external profile μn,k satisfies, for n, k ≥ 1,  k  n−1  pj q k−j n 1 − pj q k−j μn,k = j 0≤j≤k  k − 1 n−1  (10) − pj q k−1−j n 1 − pj q k−1−j j 0≤j −2),

where g(s) = 1 − 1/(p−s + q −s ). Proof. By definition and (8)

 k − 1 j+1 k−1−j j k−j j k−1−j )z )z pj q k−1−j z pe(1−p q + qe(1−p q )z − e(1−p q . Mk (z)= j 0≤j 0. The proof of (26) follows directly from the next proposition in view of (8) and [z n ]M1 (z) ≥ 0. Proposition 2. Let f (z) be an entire function and let z = reiθ , where r ≥ 0 and |θ| ≤ π. If |ez f (z)| ≤ er f (r) (r ≥ 0; |θ| ≤ π),    where f (r) ≥ 0, then the sum fk (z) := 0≤j≤k kj f (pj q k−j z) satisfies (27)

2

|ez fk (z)| ≤ er fk (r)e−crθ ,

(28)

uniformly for k ≥ 0, r ≥ 0, and |θ| ≤ π, where c > 0 is independent of z and k. Proof. By (27) and the elementary inequality 1 − cos θ ≥

(29) we obtain

2 2 θ π2

(|θ| ≤ π),

 k i k−j j k−j |e fk (z)| ≤ e(1−p q )r cos θ ep q r f (pj q k−j r) j 0≤j≤k   k i k−j 2 2 j k−j ≤ e(1−p q )r(1−2θ /π ) ep q r f (pj q k−j r) j z

0≤j≤k

≤ e−2rθ

2

(1−pk )/π 2 r

e fk (r).

This proves (28) with, say, c = 2(1 − p)/π 2 .

1838

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

˜ k (z) more precisely in the folProof of (22) in Theorem 1. We next evaluate M lowing lemma whose proof is presented in Appendix A. Let   k − 1 m k−m −pm qk−m z p q ze . Sk,m (z) := m Lemma 3. (i) (m = 0). If 1 ≤ k ≤ k0 − α1 Kn /LLn , then   ˜ k (z) = q k ze−qk z 1 + O(e−Kn ) , M (30) −1/2

uniformly for |z| = n and arg(z) = o(LLn (ii) (m ≥ 1). If (31)

).

k = α1 (Ln − LLLn + log(p/q − 1) + m log(p/q) − η) ,

where m ≥ 1 and Kn Kn ≤ η ≤ log(p/q) − , LLn LLn then   ˜ k (z) = Sk,m (z) 1 + O(me−Kn ) , M

(32)

−1/2

uniformly for |z| = n and arg(z) = o(LLn ). Using the above lemma, we now prove Theorem 1. It remains to evaluate the integral in (25). We first consider the case m = 0. By substituting (30) into the integral in (25), and by completing the arc | arg(z)| ≤ θ0 to a full circle, we see that

k k n! ˜ k (z)dz = q n! z −n−1 ez M z −n e(1−q )z dz + O(E1 ) |z|=n |z|=n 2πi 2πi | arg(z)|≤θ0

| arg(z)|≤θ0

k

= q n![z where E1 := e

−Kn

n!n

−n k

θ0

]e(1−q

e(1−q

q n

E2 := q k n!n1−n

n−1

k

k

)z

+ O(E2 ) + O(E1 ),

)n cos θ

dθ,

−θ0 π

e(1−q

k

)n cos θ

dθ.

θ0

By inequality (29), we have  

∞ −Kn 1/2 k −qk n −2n(1−qk )θ 2 /π 2 E1 = O e n q ne e dθ −∞

k = O e−Kn q k ne−q n . Similarly,



k 1/5 2 E2 = O q k ne−q n n−1/10 e−2n /π .

This completes the proof of (22) when m = 0. For m ≥ 1, we proceed in a similar manner but using part (ii) of Lemma 3.

1839

PROFILE OF TRIES

Proof of (23) in Theorem 1. We now consider the remaining gaps when k is of √ the form (31) with η = x/LLn , where x = o( LLn ). In this case, the same analysis as above shows that both terms Sk,m (z) and Sk,m+1 (z) are asymptotically close so that ˜ k (z) = (Sk,m (z) + Sk,m+1 (z)) (1 + O(E3 )) , M

(33)

where the error E3 introduced is bounded above by ⎞ ⎛   Sk,j (z)    Sk,j (z)   ⎠   E3 = O ⎝  Sk,m (z)  +  Sk,m (z)  0≤j<m



m+2≤j≤k

η

= O (m + 1)L−(1−qe n

cos θ/p)





+ O ⎝m!

 (pα1 /q)j j≥2



(j + m)!

j



j− (p/q) −1 eη cos θ ⎠ Ln p/q−1

= O (m + 1)L−(1−q/p) + (m + 1)−1 L−(p/q−1) n n

, = O (m + 1)L−(1−q/p) n

since 1 − q/p ≤ p/q − 1, where we used the inequality tj − 1 t+1 ≥ j t−1 2

(t > 1; j ≥ 2),

−1/2

). Thus the same analysis as above gives  

η

k m m k−m −pm qk−m n pL1−e n , p q 1 + O (m + 1)L−(1−q/p) = ne 1+ n m! q(m + 1) log(1/q)

and θ = o(LLn μn,k

which implies (23). 3.4. Range (II): A saddle-point analysis. We now assume that α1 (Ln − LLLn + Kn ) ≤ k ≤ α2 (Ln − Kn Ln ), (34) and proceed by the saddle-point method (see [79, 83]) to derive the following main result of this subsection. Theorem 2 (asymptotics of μn,k in range (II)). If k satisfies (34), then  

n−ρ (p−ρ + q −ρ )k  1 1 + 1+O (35) μn,k = G1 ρ; logp/q pk n , k(p/q)ρ k(ρ + 2)2 2πβ2 (ρ)k where ρ = ρ(n, k) > −2 is chosen to satisfy the saddle-point equation ⎧  d  ρ −ρ −ρ −ρ ⎪ ⎪ ρ e n (p + q −ρ )k = 0 if ρ ≥ 1, ⎨ dρ (36)  ⎪ d  −ρ −ρ ⎪ ⎩ n (p + q −ρ )k = 0 if ρ ≤ 1, dρ and (37)

p−ρ q −ρ log(p/q)2 β2 (ρ) := , (p−ρ + q −ρ )2  G1 (ρ; x) = g(ρ + itj )Γ(ρ + 1 + itj )e−2jπix j∈Z

(tj := 2jπ/ log(p/q))

1840

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

with g(s) = 1 − 1/(p−s + q −s ), and G1 (ρ, x) is a 1-periodic function (see Figures 3 and 4). We devote the rest of this subsection to the proof of Theorem 2. 3.4.1. Two-step saddle-point method. Here we outline the main steps of the proof of Theorem 2. The approach may be called a two-step saddle-point method since the saddle-point method will be applied twice. First, we start from the Mellin integral ˜ k (reiθ ) for (6) and apply the saddle-point method to obtain precise asymptotics of M small θ (i.e., around the real axis) and large r. The proof here is complicated by the fact that   −ρ−it p (38) + q −ρ−it  = p−ρ + q −ρ when t = tj = 2πj/ log(p/q), j ∈ Z, which implies that the number of saddle-points with the same real part is infinite, yielding the 1-periodic function G1 (ρ; x). This first application of the saddle-point method yields a good approximation to ˜ k (z) by another ˜ k (z) for z large and near the real axis; then we de-Poissonize M M ˜ application of the saddle-point method and establish that μn,k ∼ Mk (n). Ultimately, we will use the de-Poissonization result of Proposition 1; however, in the first approximation we do de-Poissonization by “bare hands” by applying the argument already used in the proof of Proposition 1, namely, (17) and (18). Thus we focus on the evaluation of the Cauchy integral (13) but with |θ| ≤ n−2/5 (the first integral of (25)). k

3.4.2. Location of saddle-points. The integrand z −s Γ(s+1)g(s) (p−s + q −s ) of the integral in (6) has simple poles at s = −j, j = 2, 3, . . . , the rightmost (dominant) one being at s = −2; it also has saddle-points, which are the zeros of the equation (39)

 d  Γ(s + 1)n−s (p−s + q −s )k = 0 ds

(note that g(s) is uniformly bounded for all s). In view of (38), there are infinitely many saddle-points of the form ρ + itj / log(p/q) (j = 0, ±1, . . .), where the real part ρ satisfies (39). Also it is easy to see that  1 , ρ → +∞ if Lkn ↓ log(1/q) k 1 ρ → −∞ if Ln ↑ log(1/p) . We distinguish between two cases ρ ≥ 1 and −2 < ρ < 1. In the former, the saddle-points are asymptotically determined, by Stirling’s formula for the Gamma function, by the first equation in (36), which is simpler than (39), while in the latter case they are asymptotically determined by the second equation of (36) since Γ(ρ + 1) is uniformly bounded and thus does not contribute significantly to the saddle-point location. More precisely, first consider the case when ρ ≥ 1 (the choice of 1 being arbitrary). In this case, by (36), we obtain p−ρ + q −ρ k = −ρ , Ln − log ρ p log(1/p) + q −ρ log(1/q) which can be written in the form 1 log ρ= log(p/q)



Ln − log ρ − k log(1/p) k log(1/q) − Ln + log ρ

 ,

1841

PROFILE OF TRIES

whenever Ln − log ρ < k log(1/q), which will be seen to be the case when k satisfies (34). On the other hand, when ρ ≤ 1, we consider the second equation in (36) or k p−ρ + q −ρ , = −ρ Ln p log(1/p) + q −ρ log(1/q) which is solved to be (40)

ρ=

1 log log(p/q)



Ln − k log(1/p) k log(1/q) − Ln

 .

It follows that if k satisfies (34), then   log(p/q) 1 (41) + o(1) , ρ≤ LLn − log Kn + log log(p/q) log(1/q) implying, in particular, that ρ = O(LLn ). Also, if k = α1 (Ln − LLLn + log log(p/q) + Kn ), then   1 log(p/q) −1 ρ= + O(Kn ) . LLn − log Kn + log log(p/q) log(1/q) However, if k is close to the right boundary of (34), more precisely, k = α2 (1 − εn )Ln , where εn = o(1), then ρ = −2 +

εn + O(ε2n ). α2 β2 (−2)

Thus ρ = O(1). From (41), we see that if ρ ≥ 1 and k satisfies (34), then kβ2 (ρ) = Θ(k(p/q)ρ ) and k(p/q)ρ ≥

Kn + o(1); log(p/q)

−1/2

on the other hand, if ρ ≥ −2 + Kn Ln , then k(ρ + 2)2 ≥ Kn2 . Thus the O-term in (35) is small if we choose Kn sufficiently large. 3.4.3. More transparent behaviors of μn,k . Before we present a formal proof of Theorem 2, we first discuss more transparent behaviors of μn,k in some specified ranges. The central range: α ∈ [α1 + ε, α2 − ε]. In this case, G1 is bounded and G1 (ρ; x) ∼ G1 (ρ ; x), where   1 1 − α log(1/p)  (42) ρ := log ; log(p/q) α log(1/q) − 1 also β2 (ρ) ∼ β2 (ρ ). Note that g(ρ + itj ) = 1 − pitj /(p−ρ + q −ρ ) and



G1 ρ; logp/q pk n = G1 ρ; logp/q q k n .

1842

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

More precisely, if k = α(Ln + x αβ2 (ρ )Ln ), where α ∈ [α1 + ε, α2 − ε] and 1/6 x = o(Ln ), then

μn,k = G1

   k    n−ρ p−ρ + q −ρ 1 + |x|3  k −x2 /2 √ ρ ; logp/q p n e 1+O , Ln 2παβ2 (ρ )Ln

uniformly in x. In particular, when α = 1/h, where h := p log(1/p) + q log(1/q) is the entropy of the Bernoulli variate, then ρ = −1, and it follows that

(43)

μn,k

√    h G1 −1; logp/q pk n 1 + |x|3 n −x2 /2 √ √ 1+O , = e ·√ log(p/q) 2πpq Ln Ln 1/6

1/6

uniformly for x = o(Ln ). Other approximations can be derived for Ln  x = √ o( Ln ). Thus μn,k reaches the maximum for k near Ln /h + O(1); also, μn,k increases with k when α < 1/h and decreases with k when α > 1/h; see Figure 2. See also Figure 3 for a plot of G1 (−1; x) for a few p’s. −1/2

The left boundary: ρ → −2+ and ρ + 2  Ln periodicity vanishes because G1 (ρ; x) ∼

. In this case, the dominant

2pq |g(−2)| = 2 ; ρ+2 (p + q 2 )(ρ + 2)

thus (44)

μn,k ∼ √

 k 2 k −1/2 n−ρ p−ρ + q −ρ . 2π log(p/q)(ρ + 2)

The right boundary: k/Ln → 1/ log(1/q)+ . In this case, ρ → ∞ and ρ = O(LLn ). The periodicity in the leading term of (35) does not vanish because we have G1 (ρ; x) ∼



Γ(ρ + 1 + itj )e−2jπix ,

j∈Z

and G1 is not bounded. Indeed, the periodicity becomes more pronounced for increasing ρ since  

 Γ(ρ + 1 + it)   = O e−t2 /(2ρ)+O(t4 /ρ3 )   Γ(ρ + 1)  for large ρ and t = o(ρ); see Figure 4. This estimate also implies that ⎛ G1 (ρ; x) = O ⎝





  |Γ(ρ + 1 + itj )|⎠ = O e−ρ ρρ+1 = O ρ1/2 Γ(ρ + 1) .

j∈Z

The order is tight. This means that even if we normalize G1 (ρ; x) by Γ(ρ+1), |G1 (ρ; x)| still goes to infinity with ρ.

1843

PROFILE OF TRIES

3.4.4. Proof of Theorem 2. In view of (25) (more generally, de-Poissonization ˜ k (n) and obtain precise local expansions for Proposition 1), we need only evaluate M iθ ˜ Mk (ne ) when |θ| ≤ θ0 in order to estimate the first integral of (25). We first focus ˜ k (n) and then extend the same approach to derive the asymptotics on estimating M iθ ˜ ˜ k (n). Later in subsection 3.8 we of Mk (ne ). This suffices to prove that μn,k ∼ M refine this analysis to obtain a better error term. ˜ k (n) by the inverse Mellin transform, first we move the line In order to evaluate M of integration of (6) to (s) = ρ so that

∞ ˜ k (n) = 1 M (45) Jk (n; ρ + it)dt, 2π −∞ −s where ρ > −2 is the saddle-point chosen according to (36) and Jk (n; √ s) := n Γ(s + −s −s k 1)g(s)(p + q ) . We now show that the above integral with |t| ≥ Ln is asymptotically smaller than the dominant term in (35) √ and then assess the main contribution of saddle-points falling into the range |t|√≤ Ln . Estimate of the integral when |t| ≥ Ln . Assume from now on that ρ is chosen as described above in (36). Since our ρ > −2 satisfies (40), we have, by (9),  

∞ 1 −ρ −ρ −ρ k Jk (n; ρ + it)dt = O n (p + q ) √ |Γ(ρ + 1 + it)|dt 2π |t|≥√Ln Ln  

∞ −ρ −ρ −ρ k ρ+1/2 −πt/2 = O n (p + q ) √ t e dt Ln

√ = O Lρ/2+1/4 e−π Ln /2 n−ρ (p−ρ + q −ρ )k . n −1/2

On the other hand, since ρ = O(LLn ) and ρ ≥ −2 + Kn Ln , we then obtain



√ √ √ 2 Lρ/2+1/4 e−π Ln /2 = O e−π Ln /2+O(LLn ) = O Γ(ρ + 2)e− Ln n −1/2

and ρ for large enough n; the last O-term holds uniformly for ρ ≥ −2 + Kn Ln satisfying (41). integer j for which Contribution√from each saddle-point. Let j0 be the largest  2jπ/ log(p/q) ≤ Ln . Then we can split the integral over |t|≤√Ln as follows:

 Jk (n; ρ + it)dt = Jk (n; ρ + it)dt √ |t|≤ Ln

|j|<j0

+

|t−tj |≤π/ log(p/q)

√ tj0 ≤|t|≤ Ln

Jk (n; ρ + it)dt.

The last integral is bounded above by

√ O Γ(ρ + 2)n−ρ (p−ρ + q −ρ )k e− Ln , by the same argument used above. It remains to evaluate the integrals

1 Tj := Jk (n; ρ + it)dt 2π |t−tj |≤π/ log(p/q) for |j| < j0 .

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

1844

We first derive a uniform bound for |p−ρ−it + q −ρ−it |. By the elementary inequalities (29) and √ x 1−x≤1− 2

(x ∈ [0, 1]),

we have 

  p 1 − cos t log q        p p−ρ q −ρ ) log 1 − cos (t − t ≤ p−ρ + q −ρ 1 − −ρ j −ρ 2 (p + q ) q   2  −ρ −ρ   p 2p q ≤ p−ρ + q −ρ 1 − 2 −ρ (t − tj )2 log −ρ 2 π (p + q ) q  −ρ  2 ≤ p + q −ρ e−c0 (t−tj ) ,

   −ρ−it  p + q −ρ−it  = p−ρ + q −ρ

(46)

2p−ρ q −ρ 1 − −ρ (p + q −ρ )2





uniformly for |t − tj | ≤ π/ log(p/q), where c0 = c0 (ρ) :=

2p−ρ q −ρ log(p/q)2 2 = 2 β2 (ρ). π 2 (p−ρ + q −ρ )2 π

We now take  v0 :=

k −2/5 (c0 k)−2/5

if − 2 < ρ ≤ 1, if ρ ≥ 1,

and split the integration range into two parts: |t − tj | ≤ v0 and v0 < |t − tj | ≤ π/ log(p/q). (We assume that k is so large that v0 < π/ log(p/q).) First consider the case when −2 < ρ ≤ 1. From the inequality (46), it follows that

1  (47) Tj := Jk (n; ρ + it)dt 2π v0 ≤|t−tj |≤π/ log(p/q)  

 k ∞ 2 e−c0 kv dv = O |Γ(ρ + 2 + itj )|n−ρ p−ρ + q −ρ k−2/5      1/5 |Γ(ρ + 1 + itj )| if j = 0 k = O n−ρ p−ρ + q −ρ k −3/5 e−c0 k × 1 if j = 0 for each |j| ≤ j0 . When ρ ≥ 1 and satisfies (34), we have  Tj

= O |Γ(ρ + 1 + itj )|n

−ρ

 −ρ k p + q −ρ





e (c0 k)−2/5

−c0 kv 2

dv



 k 1/5 = O |Γ(ρ + 1 + itj )|n−ρ p−ρ + q −ρ (c0 k)−3/5 e−(c0 k) for |j| ≤ j0 .

1845

PROFILE OF TRIES

The dominant terms. It remains to evaluate the integrals Tj for t in the range |t − tj | ≤ v0 . Note that, by our choice of tj ,     p−ρ−itj + q −ρ−itj = p−itj p−ρ + q −ρ = q −itj p−ρ + q −ρ , so that  i (t − tj ) p−ρ−itj log(1/p) + q −ρ−itj log(1/q) p−ρ−it + q −ρ−it · = 1 + −ρ−it −ρ−it j + q j p ! p−ρ−itj + q −ρ−itj ≥1

=1+

 i (t − tj ) ≥1

!

·

p−ρ log(1/p) + q −ρ log(1/q) , p−ρ + q −ρ

where we recall that tj = 2πj/ log(p/q). It follows that      β (ρ)  i (t − tj ) , log p−ρ−it + q −ρ−it = log p−ρ−itj + q −ρ−itj + ! ≥1

where, in particular, β1 (ρ) =

p−ρ log(1/p) + q −ρ log(1/q) . p−ρ + q −ρ

The remaining manipulation by using the saddle-point method is then straightforward. We use the local expansions ⎛ ⎞ k  −ρ−it  β (ρ) p + q −ρ−it i (t − tj ) + O(k|β4 (ρ)||t − tj |4 )⎠ = exp ⎝k p−ρ−itj + q −ρ−itj ! 1≤≤3

and Γ(ρ + 1 + it)g(ρ + it)   ⎧ (t − tj )2 ⎪ ⎪ C + C i(t − t ) + O if − 2 < ρ ≤ 1, 1 j ⎪ ⎨ 0 (ρ + 2)2   = Γ(ρ + 1 + itj )e(log ρ)i(t−tj ) 1 + C2 i(t − tj ) + O(|C2 |3 |t − tj |2 ) ⎪ ⎪ ⎪    ⎩ if ρ ≥ 1, × g(ρ + itj ) + g  (ρ + itj )i(t − tj ) + O |t − tj |2 where 

C0 := Γ(ρ + 1 + itj )g(ρ + itj ), C1 := g(ρ + itj )Γ(ρ + 1 + itj )ψ(ρ + 1 + itj ) + g  (ρ + itj )Γ(ρ + 1 + itj ),

ψ(s) = Γ (s)/Γ(s) being the logarithmic derivative of the Gamma function, and C2 := ψ(ρ + 1 + itj ) − log ρ

(ρ ≥ 1).

Here C0 and C1 are defined to be their limits when ρ = −1 and j = 0, namely,  C0 := p log(1/p)  + q log(1/q),  C1 := − 2p−1 p log(p)2 − q log(q)2 − C0 γ − 2pq log(p) log(q). 2

1846

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

Note that ψ(ρ + 1 + itj ) − log ρ = O(log(1 + |tj |)). It follows that for |j| < j0  k g(ρ + itj ) Γ(ρ + 1 + itj )n−ρ−itj p−ρ + q −ρ p−iktj Tj = 2πβ2 (ρ)k    1 1 + × 1+O . kβ2 (ρ) k(ρ + 2)2 Summing over all |j| < j0 and collecting all estimates, we obtain −ρ −ρ −ρ k  ˜ k (n) = n (p + q ) M g(ρ + itj )Γ(ρ + 1 + itj )(pk n)−itj 2πβ2 (ρ)k |j|<j0    1 1 × 1+O + . k(p/q)ρ k(ρ + 2)2

˜ k (z). To complete the de-Poissonization, we An asymptotic approximation to M ˜ need a more precise expansion of Mk (neiθ ) for small θ. The above proof by the saddle˜ k (z) for complex values point method can be easily extended mutatis mutandis to M of z lying in the right half-plane since we can write (7) as

k  ˜ k (neiθ ) = 1 M n−s e−iθs Γ(s + 1)g(s) p−s + q −s ds, 2πi (ρ) where ρ > −2 and |θ| ≤ π/2 − ε. The result is −σ −σ k  ˜ k (neiθ ) = (p + q ) M g(σ + itj )Γ(σ + 1 + itj )(neiθ )−ρ−itj p−iktj 2πβ2 (ρ)k |j|<j 0    1 1 × 1+O + (48) , k(p/q)ρ k(ρ + 2)2

uniformly for |θ| ≤ π/2 − ε and k lying in the range (34). Note that the index of the sum can be extended to infinity, but it is easier to manipulate a finite sum than an infinite series since we substitute the right-hand side into the Cauchy integral (13) and then integrate term by term. This completes the proof of (35). 3.5. Range (IV): A singularity analysis. We consider range (IV) first, leaving to the next subsection the analysis in the transitional range when k = α2 Ln + 2/3 o(Ln ). √ We show that, for k ≥ α2 Ln + Kn Ln , the asymptotics of the expected profile ˜ k (n) are dictated by the simple pole at s = −2 in (6) or, structurally, by the number M of pairs of input-strings sharing the same prefixes of length at least k. Theorem 3. If

(49) k ≥ α2 Ln + Kn α2 β2 (−2)Ln , where β2 is defined in (37), then (50)



2 3 √ μn,k = 2pqn2 (p2 + q 2 )k−1 1 + O Kn−1 e−Kn /2+O(Kn / Ln ) ,

√ uniformly for 1  Kn = o( Ln ).

PROFILE OF TRIES

1847

Proof. To prove (50), we move the line of integration (by absolute convergence of the integral) of the integral in (6) to (s) = , where Kn  := −2 − . α2 β2 (−2)Ln ˜ k (neiθ ) equals the residue of the integrand at s = −2 (the dominant term in Thus M (50)) plus the integral along (s) = :

∞ ˜ k (neiθ ) = |g(−2)|n2 e2iθ (p2 + q 2 )k + 1 M Jk (neiθ ;  + it)dt, 2π −∞ where |g(−2)| = 2pq/(p2 + q 2 ). It remains only to estimate the last integral. By the same analysis used for Tj (see (47)) and the inequality (46), we have ⎛ ⎞

 1 ⎝ ⎠ Jk (neiθ ;  + it)dt + 2π |t|≤π/ log(p/q) |t−t |≤π/ log(p/q) j |j|≥1  

 −  − − k −c0 kt2 = O |Γ( + 1)|n p +q e dt |t|≤π/ log(p/q)



     k   Γ  + 1 + 2|j| − 1 πi  e(2|j|+1)π|θ|/ log(p/q) + O ⎝n− p− + q −   log(p/q) |j|≥1 

2

e−c0 k(t−tj ) dt

× 

|t−tj |≤π/ log(p/q)

 k k =O n− p− + q − | + 2|

 k , = O Kn−1 n− p− + q − −1/2



where we used (9) to bound the sum      Γ  + 1 + 2|j| − 1 πi  e(2|j|+1)π|θ|/ log(p/q)   log(p/q) |j|≥1 ⎛ ⎞   2  π (2|j| − 1) (2|j| + 1)π|θ| ⎠ + = O⎝ (2|j| − 1) +1/2 exp − 2 log(p/q) log(p/q) |j|≥1

= O(1), uniformly for |θ| ≤ π/2 − ε. By our choice of  and by straightforward expansion, we have k

Kn−1 n− (p− + q − ) k

n2 (p2 + q 2 )

Thus (51)



2 3 k k = O Kn−1 e−Ln ( +2)+ α2 ( +2)+ 2 β2 (−2)( +2) +O(k| +2| )

2 3 √ = O Kn−1 e−Kn /2+O(Kn / Ln ) .



√ ˜ k (neiθ ) = |g(−2)|(neiθ )2 (p2 + q 2 )k 1 + O K −1 e−Kn2 /2+O(Kn3 / Ln ) , M n

1848

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

uniformly for |θ| ≤ π/2 − ε. Substituting this into (25), we deduce the desired result (50). √ √ Remarks. (i) When Kn ≥ ε Ln , we can either take Kn = ε Ln or refine the analysis to give a better error term. (ii) The asymptotic approximation (50) can also be derived from the exact expression (10) by using only elementary arguments. (iii) Also √ note that the range (49) implies that the saddle-point ρ satisfies ρ ≤ −2−Kn / Ln , but the contribution from this saddle-point is asymptotically negligible (compared to the polar singularity). 3.6. Range (III): A uniform analysis. We consider in this subsection the 2/3 transitional range k = α2 Ln + o(Ln ) and show that the transitional behavior of μn,k in this range is well described by a Gaussian distribution function. Theorem 4. If

(52) k = α2 Ln + ξ α2 β2 (−2)Ln , 1/6

where ξ = ξn,k = o(Ln ), then

    k 1 + |ξ|3 √ μn,k = |g(−2)|Φ(ξ)n2 p2 + q 2 1+O , Ln ξ 2 uniformly in ξ, where Φ(ξ) = (2π)−1/2 −∞ e−t /2 dt. Proof. We assume first that k satisfies (52) and k < α2 L (or ξ < 0). We move the line of integration of the integral in (11) to (s) = ρ, where ρ is taken to be of the same form as in (40); asymptotically (53)

  ξ ρ = −2 − + O ξ 2 L−1 . n α2 β2 (−2)Ln

(54)

By a similar analysis as the proof of Theorem 3, we obtain

˜ k (neiθ ) = 1 M Jk (neiθ ; ρ + it)dt 2π |t|≤L−2/5 n

 k 1/5 )|n−ρ p−ρ + q −ρ e−c0 Ln + O |Γ(ρ + 1 + iL−2/5 n

 k , + O k −1/2 n−ρ p−ρ + q −ρ where |θ| < π/2. By (54), we have |Γ(ρ + 1 + It follows that ˜ k (neiθ ) = 1 M 2π

iL−2/5 )| n

−2/5

|t|≤Ln

=O





1 −1/2 |ξ|Ln

+

−2/5 Ln

= O(L2/5 n ).

 k . Jk (neiθ ; ρ + it)dt + O k −1/2 n−ρ p−ρ + q −ρ

Note that since s → Γ(s + 1) + 1/(s + 2) is analytic for |s + 2| ≤ 1 − ε, we have

k n−ρ−it e−iθ(ρ+it)  −ρ−it ˜ k (neiθ ) = |g(−2)| M p + q −ρ−it dt −2/5 2π ρ + 2 + it |t|≤Ln

 −ρ k −1/2 −ρ . p + q −ρ n +O k

PROFILE OF TRIES

1849

The integral on the right-hand side is evaluated as follows:

k n−ρ−it e−iθ(ρ+it)  −ρ−it + q −ρ−it dt p −2/5 ρ + 2 + it |t|≤Ln

2 3 k |g(−2)| −ρ −iθρ  −ρ eθt−β2 (ρ)kt /2+O(k|t| ) = n e dt p + q −ρ −2/5 2π ρ + 2 + it |t|≤Ln  

∞ −t2 /2   |g(−2)| −ρ −iθρ  −ρ |t| + |t|3 e −ρ k √ = n e p +q dt, 1+O 2π Ln −∞ ξ0 + it

|g(−2)| 2π

(55) where

ξ0 := (ρ + 2) β2 (ρ)k > 0.

−1/2 by (52) and (54). Since ξ0 > 0, we have Note that ξ0 = −ξ + O ξ 2 Ln 1 2π



−∞



∞ 2 1 e−t /2 −t2 /2 dt = e e−v(ξ0 +it) dvdt ξ0 + it 2π −∞ 0



∞ 2 1 e−vξ0 e−t /2−itv dtdv = 2π 0 −∞

∞ 2 1 e−v /2−vξ0 dv = √ 2π 0 2

= eξ0 /2 Φ(−ξ0 ). The error term in (55) is estimated similarly and satisfies L−1/2 n

 

∞ 2 (|t| + |t|3 )e−t /2 −1/2 3 −v 2 /2−vξ0 dt = O Ln (v + v )e dv . |(ρ + 2) β2 (ρ)k + it| 0



−∞

Observe that e

(56)

x2 /2

 Φ(−x) =

  O x−1 if x → ∞,  x2 /2  O e if x → −∞.

Also



(v + v 3 )e−v

2

 /2−vx

0

dv =

  O x−2 if x → ∞,  3 x2 /2  O |x| e if x → −∞,

so that



v 3 e−v

2

/2−vx

2 dv = O ex /2 Φ(−x)(1 + |x|3 ) .

0

Thus      + |ξ|3 ˜ k (neiθ ) = |g(−2)|(neiθ )−ρ p−ρ + q −ρ k eξ02 /2 Φ(−ξ0 ) 1 + O 1 √ M Ln

 −ρ  −1/2 −ρ −ρ k (57) , +O k p +q n

1850

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

uniformly for |θ| ≤ π/2 − ε. Substituting this in (25) and using the expansions  k  k 2 3 −1/2 n−ρ p−ρ + q −ρ = n2 p2 + q 2 e−ξ /2+O(|ξ| Ln ) ,



2 2 , eξ0 /2 Φ(ξ0 ) = eξ /2 Φ(ξ) 1 + O |ξ|3 L−1/2 n we deduce (53) when ξ < 0. The restriction that ξ < 0 can now be removed by continuity (when ξ0 = 0 the integral path has to be properly indented) or by a similar analysis. This proves (53). One can easily check, by (56), that the asymptotic estimate (53) coincides with the two estimates (44) and (50) when ξ → −∞ and ξ → ∞, respectively. Remark. The appearance of the normal distribution function is typical when a saddle-point coalesces with a simple pole; see [83]. Also, the polynomial order (4) of μn,k now follows from (35), (50), and (53). 3.7. The range where the expected profile grows unbounded. An important consequence of the preceding results is the following characterization of the range where μn,k → ∞, which also will be seen to be the range where Bn,k is asymptotically normally distributed. Theorem 5. Define   1 2 . m0 := and α3 := 1 p/q − 1 log p2 +q 2 Then μn,k → ∞ iff     p LLLn − Kn α1 Ln − LLLn − log m0 + m0 log ≤ k ≤ α3 (Ln − Kn ) − q m0 LLn as n → ∞. Proof. Consider first the upper bound. If k ≤ α3 Ln − x, then n2 (p2 + q 2 )k ≥ (p2 + q 2 )−x , which tends to infinity if x → ∞; on the other hand, if k ≥ α3 Ln − x, then the reverse inequality holds and the right-hand side remains bounded if x is less than a positive constant. For the lower bound, we use the estimate (24). First, if k ≤ k0 = α − 1 (Ln − LLLn + log(p/q − 1)) (see (20)), then μn,k = Θ(q k ne−q

k

n

) = o(1).

Next, if km−1 ≤ k ≤ km , m ≥ 1, then by (24) η

μn,k = Θ(Sn,k,m ) = Θ(Lm−e n

/(p/q−1)

LLn ),

where k is written in the form (31). Since η ∈ [0, log(p/q)], we have m−

p eη q ≤m− ≤m− . p−q p/q − 1 p−q

Also, by the definition of m0 , we have the inequalities m0 − 1
m − m0 − 1 ≥ 0, p/q − 1 p−q

when m ≥ m0 + 1. Therefore, μn,k → ∞ if k ≥ km0 (and remains in the range k ≤ α1 (Ln − LLLn + Kn )). m −eη /(p/q−1) The remaining range is km0 −1 ≤ k ≤ km0 in which μn,k = Θ(Ln 0 LLn ), where k = α1 (Ln − LLLn + log(p/q − 1) + m0 log(p/q) − η). We distinguish three cases: (i) if η ≥ log m0 + log(p/q − 1) + m−eη /(p/q−1)

then μn,k = Θ(Ln

LLLn + Kn , m0 LLn

LLn ) and η

Lm−e n

/(p/q−1)

LLn ≤ e−Kn → 0;

(ii) if η = log m0 + log(p/q − 1) +

LLLn + x , m0 LLn

then μn,k ∼ Sn,k,m0 ∼

0 αm 1 e−x , (m0 − 1)!

uniformly for x = O(1); and (iii) if η ≤ log m0 + log(p/q − 1) + m−eη /(p/q−1)

then μn,k = Θ(Ln

LLLn − Kn , m0 LLn

LLn ) and η

Lm−e n

/(p/q−1)

LLn ≥ eKn → ∞.

Thus μn,k is bounded away from zero and infinity in the second case. This proves the theorem when k lies in ranges (I) and (IV). The remaining cases follow easily from (35) and (53). Let {x} denote the fractional part of x. The lower bound can be further refined as follows.

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

1852

Corollary 3. Let   LLLn (58) , kˆ := α1 Ln − LLLn − log m0 + m0 log(p/q) − m0 LLn ˆ ≤ k ≤ α3 (Ln − Kn ); (ii) where m0 = 1/(p/q − 1). Then (i) μn,k → ∞ for k ˆ − 2; and (iii) μn,k → 0 for k ≤ k  ˆ = O(LL−1 ), = Θ(1) if {k} n μn, k −1 ˆ →0 otherwise. Proof. The proof is similar to that of Theorem 5. We consider only the last case. First write ˆ − 1 = kˆ − {k} ˆ = α1 (Ln − LLLn + log(p/q − 1) + m0 log(p/q) − η  ) , k where η  = log m0 + log



 p LLLn ˆ − 1 + {k}/α . 1+ q m0 LLn

(We assume that kˆ is not an integer.) Then we follow the same proof as above by distinguishing three cases. In particular, the case when kˆ is an integer is also covered by the bounded case. The result is to be compared with Pittel’s result in [65], which says that the probability that the shortest path equals either κn  or κn  + 1 tends to 1, where x denotes the nearest integer to x and   j κn = α1 Ln − LLLn − log max j(q/p) . j≥1

Note that − log max j(q/p)j = − log m0 + m0 log(p/q). j≥1

Our result is slightly more precise; see section 8. 3.8. Refinement of μn,k by de-Poissonization. All expansions for μn,k that −1 we have derived so far are in terms of slowly decreasing powers of L−1 n or LLn , which will turn out to be insufficient for the asymptotics of the variance because of cancellation of dominant terms. Thus in this section we derive a more effective ˜ k (n) and its higher derivatives; namely, we derive an expansion for μn,k in terms of M expression of the form (19). The major difference here is that we do not substitute ˜ k (n) into the Cauchy integral representation for μn,k , the asymptotic expansions for M resulting in a less explicit asymptotic approximation to μn,k but with a much better error term. We start with a lemma in which we again use k0 = α1 (Ln − LLLn + log(p/q − 1)). Lemma 4. Define ⎧ k ⎨ q n if 1 ≤ k ≤ k0 , ρ0 := ρ if ρ ≥ 1 and k ≥ k0 , (59) ⎩ 1 if ρ ≤ 1,

1853

PROFILE OF TRIES

where ρ is given by (36). Then

˜ () (neiθ ) = O ρ0 n− M ˜ k (n) , M k

(60)

−1/2

uniformly for θ = o(LLn ). Proof. If ≥ 1, then, by (8),  k − 1 ˜ () (z) ˜ () (z) = (pj q k−1−j ) M M 1 k j 0≤j 0 satisfies the saddle-point equation (36), β2 (ρ) is the same as in (37), and  (ρ + 1 + itj )Γ(ρ + itj )e−2jπix , G3 (ρ; x) = j∈Z

where tj := 2jπ/ log(p/q).

1865

PROFILE OF TRIES 2/3

Asymptotics of E(In,k ) when k = α0 (Ln + o(Ln )). In this range, we write k = α0 (Ln + ξ α0 β2 (0)Ln ), 1/6

where α0 β2 (0) = 2(log(1/p)+log(1/q))/ log(p/q)2 and ξ = o(Ln ). The same uniform asymptotic analysis we used for proving (53) gives    1 + |ξ|3 √ E(In,k ) = 2k Φ(−ξ) 1 + O , Ln uniformly in ξ, where Φ(x) denotes the standard √ normal distribution function. √ Asymptotics of E(In,k ) when α0 (Ln + Kn Ln ) ≤ k ≤ α2 (Ln − Kn Ln ). The same saddle-point method and de-Poissonization procedure yield (87) E(In,k ) = G3



  n−ρ (p−ρ + q −ρ )k  1 1 ρ; logp/q p n + 1+O , k(p/q)ρ k(ρ + 2)2 2πβ2 (ρ)k k

with ρ, β2 (ρ), and G3 as defined above. 2/3 Asymptotics of E(In,k ) when k = α2 (Ln + o(Ln )). In this case, we write k = α0 (Ln + ξ α2 β2 (−2)Ln ), and we have E(In,k ) =

   1 + |ξ|3 1 √ Φ(ξ)n2 (p2 + q 2 )k 1 + O , 2 Ln

1/6

uniformly for ξ = o(Ln ). √ Asymptotics of E(In,k ) when k ≥ α2 (Ln + Kn Ln ). In this case, the simple pole at s = −2 in the integrand of (85) dominates, and we have



2 3 −1/2 1 E(In,k ) = n2 (p2 + q 2 )k 1 + O Kn−1 e−Kn /2+O(Kn Ln ) 2 as n → ∞. 6.2. Asymptotics of V(In,k ). Since V(In,k ) = V(I¯n,k ), we can apply the same analysis used for proving Theorem 7 to derive asymptotic approximations to V(In,k ). The auxiliary function we need is ⎞2 ⎛ 2  E(I¯n,k  E(I¯n,k ) ) [I] V˜k (z) := e−z z n − ⎝e−z zn⎠ , n! n! n≥0

which satisfies (88)

[I] V˜k (z) =

n≥0

 k  [I] V˜ (pj q k−j z) j 0

(k ≥ 0),

0≤j≤k

[I] where V˜0 (z) = (1 + z)e−z (1 − (1 + z)e−z ). Thus we have

  1 [I] ˜ Vk (z) = z −s (s + 1)Γ(s) 1 − 2−s − s2−s−2 (p−s + q −s )k ds, 2πi (ρ)

where ρ > −2.

1866

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

Asymptotics of V(In,k ) when 1 ≤ k ≤ α1 (1 + o(1))Ln . In this range, we have V(In,k ) ∼ V(Bn,k ) ∼ E(Bn,k ).

√ Asymptotics of V(In,k ) when α1 (Ln − LLLn + Kn ) ≤ k ≤ α2 (Ln − Kn Ln ). We have  

n−ρ (p−ρ + q −ρ )k  1 1 k + 1+O , V(In,k ) = G4 ρ; logp/q p n k(p/q)ρ k(ρ + 2)2 2πβ2 (ρ)k where ρ = ρ(n, k) > −2 satisfies the saddle-point equation (36) and    G4 (ρ; x) = (ρ + 1 + itj )Γ(ρ + itj ) 1 − 2−ρ−itj − (ρ + itj )2−ρ−2−itj e−2jπix . j∈Z

√ Asymptotics of V(In,k ) when k ≥ α2 (Ln + Kn Ln ). In this case, the simple pole at s = −2 again dominates, and we have V(In,k ) ∼ E(In,k ). Observe that, unlike for the external profile, the variance of the internal profile is asymptotically equivalent to the mean of the internal profile near the height of a trie. From these asymptotic estimates and from Chebyshev’s inequality, we see that In,k /E(In,k ) → 1 in probability if E(In,k ) → ∞; see [15]. 6.3. Limiting distributions. The same limiting Gaussian–Poisson behavior for Bn,k holds for In,k . We state formally our main result for the internal profile in the following theorem. The proof is indeed simpler than that for Theorem 8 since the [I] base function P0 (z, y) has a simpler form than P0 (z, y). Theorem 9. (i) If V(In,k ) → ∞, then In,k − E(In,k ) d −→ N (0, 1). V(In,k ) (ii) If V(In,k ) = Θ(1), then, with λ1 := n2 (p2 + q 2 )/2, (89)

P(In,k = m) =

λm 1 e−λ1 + o(1) m!

for all m ≥ 0. The theorem states that asymptotic normality (in the sense of convergence in distribution) holds as long as ˆ ≤ k ≤ α3 Ln − Kn k for any sequence Kn → ∞, where kˆ is defined in (58). On the other hand, In,k is asymptotically Poisson distributed when k = α3 Ln + O(1). A result related to (89) was given in [65] by a method of moments, as a key step in deriving the asymptotic distribution of the height. 7. Profiles under the unbiased Bernoulli model. All exact expressions we have derived up to now, as well as most asymptotic approximations, also hold when p = q = 1/2. The major difference is reflected by the fact that α1 = α2 (see Figure 2), so that the saddle-point range between α1 and α2 does not exist, and most of the analysis we give above becomes much simpler. For simplicity of presentation, we omit all error terms in our asymptotic estimates.

1867

PROFILE OF TRIES

Expected external profile. By (8), the Poisson generating function of E(Bn,k ) is given exactly by

˜ k (z) = z e−z/2k − e−z/2k−1 (90) (k ≥ 1). M From this we deduce, by our de-Poissonization procedures, that   n−1 if 2−k n → ∞, n 1 − 2−k E(Bn,k ) ∼ (91) ˜ Mk (n) if 4−k n → 0, where the condition 4−k n → 0 is due to the properties that

˜ () (z) = O 2−k |M ˜ k (z)| M (| arg(z)| ≤ π/2 − ε) k and 2−k = o(n−1/2 ); see Proposition 1 and compare with (61). In particular,    if 2−k n → t ∈ (0, ∞), ne−t 1 − e−t E(Bn,k ) ∼ −k 2 2 n if 2−k n → 0. Note that these approximations can also be easily derived by the exact formula n−1 n−1   E(Bn,k ) = n 1 − 2−k (92) − n 1 − 21−k , by (90) or (10). But such an elementary approach becomes messier for the calculation of the variance. Also n max E(Bn,k ) ∼ , k 4 which is reached when k ∼ log2 n − 1. Expected internal profile. In a similar manner, we have, by (84), ˜ [I] (z) = 2k − (2k + z)e−z/2k M k Therefore, the expected internal profiles satisfy   n−1 2k − n 1 − 2−k E(In,k ) ∼ ˜ [I] (n) M k

(k ≥ 0).

if 2−k n → ∞, if 4−k n → 0.

Consequently,  E(In,k ) ∼ Note that

  if 2−k n → t ∈ (0, ∞), 2k 1 − (1 + t)e−t −k−1 2 2 n if 2−k n → 0.

  n n−1 − n 1 − 2−k E(In,k ) = 2k 1 − 1 − 2−k

and (93)

max E(In,k ) ∼ c3 n, k

where c3 ≈ 0.298 denotes the maximum value achieved by the function (1 − (1 + x)e−x )/x for x ∈ R+ .

1868

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

Asymptotics of the variances. Similarly, by (63) and (88), we have



k k−1 k−1 k k−1 2 + 2−k z 2 e−z/2 V˜k (z) = z e−z/2 − e−z/2 − 21−k z 2 e−z/2 − e−z/2 ,   k k−1 2 [I] V˜k (z) = (2k + z)e−z/2 − 2k 1 + 2−k e−z/2 ; accordingly, if n/2k → ∞, then  n−1 V(Bn,k ) ∼ V(In,k ) ∼ E(Bn,k ) ∼ n 1 − 2−k , and if n/4k → 0, then V(Bn,k ) ∼ V˜k (n)

[I] and V(In,k ) ∼ V˜k (n),

uniformly in k. These approximations imply that    ne−t 1 − (1 + t)e−t + 2te−2t (2 − e−t ) if 2−k n → t ∈ (0, ∞), (94) V(Bn,k ) ∼ if 2−k n → 0 2E(Bn,k ) ∼ 21−k n2 and

 V(In,k ) ∼

  2k (1 + t)e−t 1 − (1 + t)e−t if 2−k n → t ∈ (0, ∞), −k−1 2 n if 2−k n → 0. E(In,k ) ∼ 2

Limiting distributions. Both Theorems 8 and 9 (asymptotic normality of Bn,k and In,k , respectively) hold when p = q = 1/2 by the same method of proof. Note that both bivariate generating functions become simpler (see (72) and (83)):   k−1 2 2 z z/2k z/2k−1 2z Pk (z, y) = e + (y − 1) k−1 e − 1 + (y − 1) k , 2 4 k



k z 2 [I] Pk (z, y) = yez/2 + (1 − y) 1 + k . 2 Observe that, as n → ∞, E(Bn,k ) → ∞ iff V(Bn,k ) → ∞ iff V(In,k ) → ∞ iff   1 Kn 2 (Ln − Kn ) (95) ≤k≤ Ln − LLn + log 2 Ln log 2 for any sequence Kn → ∞ with n; compare Theorem 5 for the asymmetric case. Theorem 10. (i) If k lies in the range (95), then Bn,k − E(Bn,k ) d −→ N (0, 1), V(Bn,k )

In,k − E(In,k ) d −→ N (0, 1). V(In,k )

(ii) If k = 2(Ln + O(1))/ log 2, then, with λ2 := 2−k−1 n2 , ⎧ λm ⎪ 2 ⎪ e−λ2 + o(1), P(Bn,k = 2m + 1) = o(1), ⎨ P(Bn,k = 2m) = m! ⎪ λm ⎪ ⎩ P(In,k = m) = 2 e−λ2 + o(1), m! uniformly for m ≥ 0. Note that when p = q, λ0 = λ1 = λ2 .

PROFILE OF TRIES

1869

8. Applications of results. In this section, we briefly discuss a few properties of some shape characteristics of random tries, as implied either by our results or by our approaches. We consider only depth, height, shortest path, fill-up level, width, and right-profile. Depth. The distribution of the depth Dn is given by P(Dn = k) = μn,k /n. Our asymptotic approximations for μn,k give very precise results for the distribution of Dn . First consider the case when p = q. By definition, we see that the result (4) for the limiting behaviors of log μn,k / log n also describes those of −1 + log P(Dn = k)/ log n, or essentially the large deviations of the distribution of Dn . Furthermore, (43) can be regarded as a local limit theorem for Dn . Indeed, we have, for k = h−1 (Ln + x h−1 β2 (−1)Ln ), where h := p log(1/p) + q log(1/q) is the entropy rate, (96)

P(Dn = k) = G1



   1 + |x|3 √ −1; logp/q p n 1+O , Ln 2πV(Dn ) k



e−x

2

/2

1/6

uniformly for x = o(Ln ), where V(Dn ) ∼ (h2 − h2 )/h3 log n, with h2 := p log2 p + q log2 q (see [33, 76]), is also rederived below in (97). Because of the appearance of the uncommon periodic function G1 , we see that Dn satisfies a central limit theorem but not a local limit theorem (of the usual form). It can be shown that the right-hand side indeed sums (over all k) asymptotically to 1. The result (96) is new. If p = q, then, by the exact formula (92), we have n−1  n−1  − 1 − 21−k , P(Dn = k) = 1 − 2−k which implies that

−+{log n}    1−+{log2 n} 2 P(Dn = log2 n + ) = e−2 − e−2 1 + O n−1 2− , uniformly for ∈ Z, where {x} denotes the fractional part of x. On the other hand, if one is interested in the cumulative distribution functions or tail probabilities, then, by (6) and by partial summation, ez P(Dn ≤ k) = (n − 1)![z ] 2πi

n

k  z −s Γ(s + 1) p−s + q −s ds

(ρ)

for k ≥ 1, where ρ > −1. Equivalently, by (11), we have (see [35]) P(Dn ≤ k) =

1 2πi

(ρ)

k Γ(n)Γ(s + 1)  −s p + q −s ds, Γ(n + 1 + s)

where ρ > −1. Asymptotics of such integrals can be treated by our approaches, which give not only the central limit theorem of Dn with convergence rate (since there is a simple pole at s = −1) but also precise estimates for tail probabilities. Indeed, we have   

1 + |x|3 −1 −1 √ P Dn ≤ h (Ln + x h β2 (−1)Ln ) = Φ(x) 1 + O , Ln

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

1870

1/6

uniformly for x = o(Ln ), as already shown in [33, 35] (but without rate). Furthermore,   log P(Dn ≤ αLn ) → ρ + 1 − α log(p−ρ + q −ρ ) (α1 ≤ α ≤ h−1 ), log n     log P(Dn ≥ αLn ) ρ + 1 − α log(p−ρ + q −ρ ) if h−1 ≤ α ≤ α2 , − → −1 − α log(p2 + q 2 ) if α2 ≤ α ≤ α3 , log n



both tails being asymptotic to −1 for smaller and larger α, respectively, where ρ is given in (42). These results imply, in particular, that E(Dn ) ∼ Ln /h and (97)

V(Dn ) ∼ β2 (−1)h−3 Ln =

pq log2 (p/q) h2 − h2 L = Ln , n (p log(1/p) + q log(1/q))3 h3

where h2 := p log2 p + q log2 q; see [13, 76]. Note that the constant on the right-hand side becomes zero when p = q. Width. The width of tries Wn is defined to be Wn := maxk In,k , or the size of the most abundant level(s). As a natural lower bound for E(Wn ), we consider maxk E(In,k ). By (87) and a similar analysis for (43), we have, when p = q,

√ h G3 −1; logp/q pk n n

√ 1 + O(L−1/2 E(In,k ) = ) , ×√ n log(p/q) 2πpq Ln uniformly for k = Ln /h + O(1). This approximation, together with the estimates for E(In,k ) in other ranges given in section 6.1, yields E(Wn ) ≥ max E(In,k ) = Θ(nL−1/2 ), n k

when p = q. Indeed, we have E(Wn ) = Θ(nL−1/2 ). n The upper bound can be proved by applying the arguments used in [16], which start from the inequality E(Wn ) ≤ Mn +

 2/3 |k−Ln /h|≤εLn

V(In,k ) + Mn − E(In,k )



E(In,k ),

2/3 |k−Ln /h|>εLn

where Mn : maxk E(In,k ), and then using the asymptotics of E(In,k ) and V(In,k ) given in section 6.1. Details are omitted here. Finer results for E(Wn ) can be derived, but the proof is more involved due to the presence of the periodic function G3 (whose parameter involves k). For symmetric tries, we easily have E(Wn ) = Θ(n), by (93) and the trivial bound E(Wn ) ≤ n. Thus random symmetric tries are “fatter,” and most nodes lie near the most abundant levels k = log2 n + O(1). Height. We next derive an estimate for the height of random tries, as a consequence of our estimates for the external profiles together with the use of the first and second moment methods (see [79]). Corollary 6 (height of a trie). Let Hn := max{k : Bn,k > 0} be the height of a random trie. Then Hn / log n → α3 in probability.

PROFILE OF TRIES

1871

Proof. Let kH := α3 Ln . First we derive an upper bound for Hn as follows: P(Hn > (1 + ε)kH ) ≤ P(Bn,k ≥ 1) (for some k ≥ (1 + ε)kH ) ≤ E(Bn,k ) → 0, where the last inequality follows from Theorem 3 when p = q and (91) when p = q. For the lower bound, we use the second moment method (see [79]) to find P(Hn < (1 − ε)kH ) ≤ P(Bn, (1−ε)kH = 0) V(Bn, (1−ε)kH ) (E(Bn, (1−ε)kH ))2   1 =O →0 E(Bn, (1−ε)kH )



by Theorems 3 and 7 and (94). Combining the two estimates, we obtain the required result. Corollary 6 is not new and has already been derived in Devroye [12], Pittel [64, 65], and Szpankowski [77]. Shortest path. The shortest path Sn := min{j : Bn,j > 0} of a random trie, discussed next, has attracted much less attention than the height (see [79]) in the literature. It is closely related to the behaviors of the external profile in range (I) near k = α1 (Ln − LLLn + O(1)) as discussed in Theorem 1 and its refinement in Corollary 3. Define ⎧   LLLn ⎨ α − LLL − log m + m log(p/q) − L if p = q, 1 n n 0 0 kˆ := m0 LLn ⎩ if p = q, α1 (Ln − LLn ) where m0 := 1/(p/q − 1), and  kS :=

ˆ k ˆ k

if p = q, if p = q.

Corollary 7 (shortest path length of tries). If p = q, then  ˆ kS if {k}LL n → ∞, Sn = ˆ kS or kS − 1 if {k}LLn = O(1) with high probability;2 if p = q = 1/2, then  kS + 1 Sn = kS or kS + 1

ˆ n → ∞, if {k}L ˆ n = O(1) if {k}L

with high probability. ˆ Proof. Assume p = q. Consider first the case {k}LL n → ∞. In this case we have, by Corollary 3,  μn,kS → ∞, μn,k → 0 for k ≤ kS − 1. 2 We say that an event holds with high probability if it holds with probability tending to 1 as n → ∞.

1872

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

Thus, again by the second moment method, P(Sn > kS ) ≤ P(Bn,kS

V(Bn,kS ) = 0) ≤ =O (E(Bn,kS ))2



1



μn,kS

→ 0.

On the other hand, by using the first moment method, we have P(Sn < kS ) ≤ P(Bn,k ≥ 1) (for some k < kS ) ≤ μn,k → 0. These two estimates imply that P(Sn = kS ) → 1. ˆ Now if {k}LL n = O(1), then, again by Corollary 3, ⎧ ⎨ μn,kS → ∞, μn,kS −1 = Θ(1), ⎩ μn,k → 0 for k ≤ kS − 2. Thus applying mutatis mutandis the same proof gives P(Sn = kS ) + P(Sn = kS − 1) → 1. The proof for the symmetric case is similar, because μn,k → ∞ when k lies in the range (95), and from this result we deduce that μn,kS +1 → ∞, μn,kS −1 → 0, and  μn,kS

ˆ n → ∞, →0 if {k}L ˆ n = O(1). = Θ(1) if {k}L

This completes the proof. Fill-up level. We now consider the fill-up level Fn = max{k : In,k = 2k } of a random trie, which was also analyzed previously by Devroye [12], Pittel [64, 65], and Knessl and Szpankowski [49]. Corollary 8 (fill-up level of a trie). If p = q, then  ˆ kS − 1 if {k}LL n → ∞, Fn = ˆ kS − 2 or kS − 1 if {k}LLn = O(1) with high probability; if p = q = 1/2, then  kS Fn = kS or kS − 1

if if

ˆ n → ∞, {k}L ˆ {k}Ln = O(1).

Proof. Observe that Fn = max{k : I¯n,k = 0} = min{k : I¯n,k > 0} − 1. By (86), we have E(I¯n,k ) ∼ μn,k when k ≤ α1 (1 + o(1))Ln . Thus the proof of Corollary 7 applies with little modification. Profile enumerating only right branches. We consider the random variable Rn,k , which denotes the number of external nodes in random tries that are away from the root by k right branches. Since a right branch means a “1” in the input-string, Rn,k enumerates the number of strings with exactly k 1’s; it also has other concrete interpretations in splitting processes and conflict resolution algorithms. All of our

1873

PROFILE OF TRIES

tools can be extended to Rn,k , although Rn,k exhibits very different behaviors. For example, unlike Bn,k or In,k , there is no need to distinguish between symmetric and asymmetric tries, all results being uniform in p; also, the Poisson heuristic holds for all k ≥ 0. This example further reveals the power of our approaches. The probability generating function Fn,k (y) := E(y Rn,k ) of Rn,k satisfies the recurrence  n pj q n−j Fj,k−1 (y)Fn−j,k (y) (n ≥ 2; k ≥ 0), Fn,k (y) = j 0≤j≤n

with the initial conditions Fn,k (y) = 1 forn ≤ 1 or k < 0 and F2,1 (y) = y. Thus the bivariate generating function Fk (z, y) := n Fn,k (y)z n /n! satisfies  k+j−1 F0 (pk q j z, y)( j ) , Fk (z, y) = Fk (qz, y)Fk−1 (pz, y) = j≥0

where F0 (z, y) = epz F0 (qz, y) + p(1 − p/2)(y − 1)z 2 , which is further solved to be (98)

F0 (z, y) = ez + p(1 − p/2)(y − 1)



(q j z)2 e(1−q

j

)z

.

j≥0

From this we deduce that the expected right-profile is given by

ez p−ks E(Rn,k ) = p(1 − p/2)n![z n] z −s Γ(s + 2) ds, 2πi (ρ) (1 − q −s )k+1 where −2 < ρ < 0. The integral is not of the same type as (6) but is similar, and our methods of proof easily extend. It has simple poles at s = −2, −3, . . . and poles of order k + 1 at s = 2jπi/ log(1/q), j ∈ Z. Thus the asymptotics of E(Rn,k ) are divided into four overlapping ranges. • If 0 ≤ k = o(log n), then the residues of the poles on the imaginary lines are dominant, and we have ⎛ ⎞  (log pk n)k ⎝1 + E(Rn,k ) ∼ p(1 − p/2) Γ(1 + χj )(pk n)−χj ⎠ , k!(log(1/q))k+1 j=0

uniformly in k, where χj := 2jπi/ log(1/q). √ • If k → ∞ and k ≤ α∗ (Ln − Kn Ln ), where Kn → ∞ and α∗ :=

1 − q2 , (1 − q 2 ) log(1/p) − q 2 log(1/q)

then by the saddle-point method  p(1 − p/2)q ρ/2 k −ρ (p n) (1 − q −ρ )−k E(Rn,k ) ∼ √ Γ(ρ + 1 + χj )(pk n)−χj , 2πk log(1/q) j∈Z uniformly in k, where ρ = log1/q

log(pk n) . log(pk n/q k )

1874

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

• If k = α∗ Ln + x α∗ (1 + α∗ log(p/q))(1 + α∗ log p)Ln , then E(Rn,k ) ∼

1 Φ(x)(pk n)2 (1 − q 2 )−k , 2

1/6

uniformly for x = o(Ln ). • If k ≥ α∗ Ln + Kn α∗ (1 + α∗ log(p/q))(1 + α log p)Ln , then E(Rn,k ) ∼

1 k 2 (p n) (1 − q 2 )−k . 2

These results imply that, as n → ∞, E(Rn,k ) → ∞ iff 1≤k≤

2 Ln − Kn , log 2−p p

where Kn → ∞ with n. Note that log e−z F0 (z, y) = log(1 + (y − 1)τ (z)),  j where τ (z) := p(1 − p/2) j≥0 (q j z)2 e−q z satisfies τ (z) = O(|z|2 ) as z → 0, and, by Mellin transform, τ (z) = O(1) as |z| → ∞ in a small sector containing the real axis. This yields, by a straightforward modification of our approaches, that V(Rn,k ) = Θ(E(Rn,k )) for all k = k(n) ≥ 0 and that Rn,k − E(Rn,k ) d −→ N (0, 1) V(Rn,k ) whenever E(Rn,k ) or V(Rn,k ) → ∞. Two remaining cases are k = 0 and k = 2Ln / log 2−p p + O(1). In the first case, Rn,0 by (98) is Bernoulli distributed with mean equal to τ (n), which is asymptotic to the periodic function ⎛ ⎞  1 ⎝1 + Γ(2 − χj )n−χj ⎠ , log(1/q) j=0

and in the second case, P(Rn,k = m) =

λm 3 e−λ3 + o(1), m!

where λ3 := (pk n)2 (1 − q 2 )−k /2. Appendix A: Proof of Lemma 3. In this appendix, we prove Lemma 3. For −1/2 part (i) let z = neiθ , where θ = o(LLn ). By (8)



 k − 1 j k−j j k−1−j n cos θ ˜ Mk (z) = pj q k−j ze−p q z 1 + O e−(p−q)p q j 0≤j 0, ∗

ε ei¯ ∞

xρ+it−1 f (x)dx

∞ i¯ ε(ρ+it) =e xρ+it−1 f (xei¯ε )dx 0  

1

∞ −¯ εt ρ+1 −¯ εt ρ −qx cos ε¯ = O(e x dx) + O e x e dx 0 1

= O e−¯εt ρ−1 + e−¯εt q −ρ ρ1/2 (ρ/e)ρ ,

f (ρ + it) =

0

uniformly in ρ and t. If t < 0, then changing ei¯ε to e−i¯ε gives

f ∗ (ρ + it) = O e−¯ε|t| ρ−1 + e−¯ε|t| q −ρ ρ1/2 (ρ/e)ρ . When −2 < ρ ≤ 1, f ∗ (ρ + it) = O(e−¯ε|t| ) for large |t| by the same argument. On the other hand, by the first estimate in (101), we also have   f ∗ (s) = O |s + 2|−1 (s → 2). With these estimates and the Mellin inversion integral

1 fk (z) = z −s f ∗ (s)(p−s + q −s )k−1 ds, 2πi (ρ) ˜ k (z) and prove that fk (z) = Θ(|M ˜ k (z)|) for we can apply the arguments used for M | arg(z)| ≤ ε¯. REFERENCES [1] R. Aguech, N. Lasmar, and H. Mahmoud, Distribution of inter-node distances in digital trees, in Proceedings of the 2005 International Conference on Analysis of Algorithms, C. Mart´ınez, ed., Discrete Mathematics and Theoretical Computer Science, Nancy, France, 2005, pp. 1–10. [2] D. Aldous and P. Shields, A diffusion limit for a class of randomly-growing binary trees, Probab. Theory Related Fields, 79 (1988), pp. 509–542. [3] B. C. Berndt, Ramanujan’s Notebooks. Part I, Springer-Verlag, New York, 1985. [4] J. Bourdon, M. Nebel, and B. Valle´ e, On the stack-size of general tries, Theor. Inform. Appl., 35 (2001), pp. 163–185. [5] B. Chauvin, M. Drmota, and J. Jabbour-Hattab, The profile of binary search trees, Ann. Appl. Probab., 11 (2001), pp. 1042–1062. [6] J.-D. Choi, K. Lee, A. Loginov, R. O’Callahan, V. Sarkar, and M. Sridharan, Efficient and precise datarace detection for multithreaded object-oriented programs, in Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 2002, pp. 258–269.

1878

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

[7] C. A. Christophi and H. M. Mahmoud, The oscillatory distribution of distances in random tries, Ann. Appl. Probab., 15 (2005), pp. 1536–1564. [8] J. Cl´ ement, P. Flajolet, and B. Vall´ ee, Dynamical sources in information theory: A general analysis of trie structures, Algorithmica, 29 (2001), pp. 307–369. [9] R. de la Briandais, File searching using variable length keys, in Proceedings of the AFIPS Spring Joint Computer Conference, AFIPS Press, Reston, VA, 1959, pp. 295–298. [10] L. Devroye, A note on the average depth of tries, Computing, 28 (1982), pp. 367–371. [11] L. Devroye, A probabilistic analysis of the height of tries and of the complexity of triesort, Acta Inform., 21 (1984), pp. 229–237. [12] L. Devroye, A study of trie-like structures under the density model, Ann. Appl. Probab., 2 (1992), pp. 402–434. [13] L. Devroye, Universal limit laws for depths in random trees, SIAM J. Comput., 28 (1998), pp. 409–432. [14] L. Devroye, Laws of large numbers and tail inequalities for random tries and PATRICIA trees, J. Comput. Appl. Math., 142 (2002), pp. 27–37. [15] L. Devroye, Universal asymptotics for random tries and PATRICIA trees, Algorithmica, 42 (2005), pp. 11–29. [16] L. Devroye and H.-K. Hwang, Width and mode of the profile for some random trees of logarithmic height, Ann. Appl. Probab., 16 (2006), pp. 886–918. [17] L. Devroye and P. Kruszewski, On the Horton-Strahler number for random tries, RAIRO Inform. Th´eor. Appl., 30 (1996), pp. 443–456. [18] M. Drmota and H.-K. Hwang, Bimodality and phase transitions in the profile variance of random binary search trees, SIAM J. Discrete Math., 19 (2005), pp. 19–45. [19] M. Drmota and H.-K. Hwang, Profile of random trees: Correlation and width of random recursive trees and binary search trees, Adv. in Appl. Probab., 37 (2005), pp. 321–341. [20] J. Fayolle and M. D. Ward, Analysis of the average depth in a suffix tree under a Markov model, in Proceedings of the 2005 International Conference on Analysis of Algorithms, C. Mart´ınez, ed., Discrete Mathematics and Theoretical Computer Science, Nancy, France, 2005, pp. 95–104. [21] J. A. Fill, H. M. Mahmoud, and W. Szpankowski, On the distribution for the duration of a randomized leader election algorithm, Ann. Appl. Probab., 6 (1996), pp. 1260–1283. [22] P. Flajolet, On the performance evaluation of extendible hashing and trie searching, Acta Inform., 20 (1983), pp. 345–369. [23] P. Flajolet, X. Gourdon, and P. Dumas, Mellin transforms and asymptotics: Harmonic sums, Theoret. Comput. Sci., 144 (1995), pp. 3–58. [24] P. Flajolet, M. R´ egnier, and D. Sotteau, Algebraic methods for trie statistics, in Analysis and Design of Algorithms for Combinatorial Problems (Udine, 1982), Math. Stud. 109, North-Holland, Amsterdam, 1985, pp. 145–188. [25] P. Flajolet and R. Sedgewick, Mellin transforms and asymptotics: Finite differences and Rice’s integrals, Theoret. Comput. Sci., 144 (1995), pp. 101–124. [26] P. Flajolet and J.-M. Steyaert, A branching process arising in dynamic hashing, trie searching and polynomial factorization, in Automata, Languages and Programming (Aarhus, 1982), Lecture Notes in Comput. Sci. 140, Springer-Verlag, Berlin, New York, 1982, pp. 239–251. [27] E. Fredkin, Trie memory, Comm. ACM, 3 (1960), pp. 490–499. [28] M. Fuchs, H.-K. Hwang, and R. Neininger, Profiles of random trees: Limit theorems for random recursive trees and binary search trees, Algorithmica, 46 (2006), pp. 367–407. [29] D. Gusfield, Algorithms on Strings, Trees, and Sequences, Cambridge University Press, Cambridge, UK, 1997. [30] H.-K. Hwang, Asymptotic expansions for the Stirling numbers of the first kind, J. Combin. Theory Ser. A, 71 (1995), pp. 343–351. [31] H.-K. Hwang, Profiles of random trees: Plane-oriented recursive trees, Random Structures Algorithms, 30 (2007), pp. 380–413. [32] H.-K. Hwang, Local Limit Theorems for the Profiles of Random Tries, preprint, 2006. [33] P. Jacquet and M. R´ egnier, Trie partitioning process: Limiting distributions, in CAAP ’86 (Nice, 1986), Lecture Notes in Comput. Sci. 214, Springer-Verlag, Berlin, 1986, pp. 196–210. [34] P. Jacquet and M. R´ egnier, Normal limiting distribution of the size of tries, in Performance ’87 (Brussels, 1987), North-Holland, Amsterdam, 1988, pp. 209–223. [35] P. Jacquet and W. Szpankowski, Analysis of digital tries with Markovian dependency, IEEE Trans. Inform. Theory, 37 (1991), pp. 1470–1475. [36] P. Jacquet and W. Szpankowski, Autocorrelation on words and its applications. Analysis of suffix trees by string-ruler approach, J. Combin. Theory Ser. A, 66 (1994), pp. 237–269.

PROFILE OF TRIES

1879

[37] P. Jacquet and W. Szpankowski, Analytical de-Poissonization and its applications, Theoret. Comput. Sci., 201 (1998), pp. 1–62. [38] P. Jacquet, W. Szpankowski, and J. Tang, Average profile of the Lempel–Ziv parsing scheme for a Markovian source, Algorithmica, 31 (2001), pp. 318–360. [39] S. Janson and W. Szpankowski, Analysis of an asymmetric leader election algorithm, Electron. J. Combin., 64 (1997), pp. 1–6. [40] P. Kirschenhofer and H. Prodinger, Some further results on digital search trees, in Automata, Languages and Programming (Rennes, 1986), Lecture Notes in Comput. Sci. 226, Springer-Verlag, Berlin, 1986, pp. 177–185. [41] P. Kirschenhofer and H. Prodinger, b-tries: A paradigm for the use of number-theoretic methods in the analysis of algorithms, in Contributions to General Algebra, Vol. 6, H¨ olderPichler-Tempsky, Vienna, 1988, pp. 141–154. [42] P. Kirschenhofer and H. Prodinger, Further results on digital search trees, Theoret. Comput. Sci., 58 (1988), pp. 143–154. [43] P. Kirschenhofer and H. Prodinger, On some applications of formulae of Ramanujan in the analysis of algorithms, Mathematika, 38 (1991), pp. 14–33. [44] P. Kirschenhofer, H. Prodinger, and W. Szpankowski, On the variance of the external path in a symmetric digital trie, Discrete Appl. Math., 25 (1989), pp. 129–143. [45] P. Kirschenhofer, H. Prodinger, and W. Szpankowski, Analysis of a splitting process arising in probabilistic counting and other related algorithms, Random Structures Algorithms, 9 (1996), pp. 379–401. [46] C. Knessl, A note on the asymptotic behavior of the depth of tries, Algorithmica, 22 (1998), pp. 547–560. [47] C. Knessl and W. Szpankowski, A note on the asymptotic behavior of the heights in b-tries for b large, Electron. J. Combin., 7 (2000), 16 pp. [48] C. Knessl and W. Szpankowski, Limit laws for the height in PATRICIA tries, J. Algorithms, 44 (2002), pp. 63–97. [49] C. Knessl and W. Szpankowski, On the number of full levels in tries, Random Structures Algorithms, 25 (2004), pp. 247–276. [50] D. E. Knuth, The Art of Computer Programming, Volume III: Sorting and Searching, 2nd ed., Addison–Wesley, Reading, MA, 1998. [51] K. Kukich, Techniques for automatically correcting words in text, ACM Comput. Surv., 24 (1992), pp. 377–439. [52] G. Louchard, Trie size in a dynamic list structure, Random Structures Algorithms, 5 (1994), pp. 665–702. [53] H. M. Mahmoud, Evolution of Random Search Trees, John Wiley & Sons, New York, 1992. [54] M. E. Nebel, On the Horton–Strahler number for combinatorial tries, Theor. Inform. Appl., 34 (2000), pp. 279–296. [55] M. E. Nebel, The stack-size of combinatorial tries revisited, Discrete Math. Theor. Comput. Sci., 5 (2002), pp. 1–16. [56] M. E. Nebel, The stack-size of tries: A combinatorial study, Theoret. Comput. Sci., 270 (2002), pp. 441–461. ¨ schendorf, A general limit theorem for recursive algorithms and [57] R. Neininger and L. Ru combinatorial structures, Ann. Appl. Probab., 14 (2004), pp. 378–418. ´ [58] M. Nguyen-The, Distribution de valuations sur les arbres, Ph.D. Thesis, LIX, Ecole Polytechnique, Palaiseau, France, 2003. [59] P. Nicod` eme, Average profiles, from tries to suffix-trees, in Proceedings of the 2005 International Conference on Analysis of Algorithms, C. Mart´ınez, ed., Discrete Mathematics and Theoretical Computer Science, Nancy, France, 2005, pp. 257–266. [60] S. Nilsson and M. Tikkanen, An experimental study of compression methods for dynamic tries, Algorithmica, 33 (2002), pp. 19–33. [61] F. W. J. Olver, Asymptotics and Special Functions, Academic Press, New York, London, 1974. [62] G. Park, Profile of Tries, Ph.D. thesis, Purdue University, West Lafayette, IN, 2006. [63] G. Park and W. Szpankowski, Towards a complete characterization of tries, in Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, Vancouver, 2005, pp. 33–42. [64] B. Pittel, Asymptotic growth of a class of random trees, Ann. Probab., 18 (1985), pp. 414–427. [65] B. Pittel, Paths in a random digital tree: Limiting distributions, Adv. in Appl. Probab., 18 (1986), pp. 139–155. [66] H. Prodinger, How to select a loser, Discrete Math., 120 (1993), pp. 149–159. ¨ schendorf, Probability metrics and recursive algorithms, Adv. in [67] S. T. Rachev and L. Ru Appl. Probab., 27 (1995), pp. 770–799.

1880

` G. PARK, H.-K. HWANG, P. NICODEME, AND W. SZPANKOWSKI

´gnier and P. Jacquet, New results on the size of tries, IEEE Trans. Inform. Theory, [68] M. Re 35 (1989), pp. 203–205. [69] Y. Reznik, Some results on tries with adaptive branching, Theoret. Comput. Sci., 289 (2002), pp. 1009–1026. [70] W. Schachinger, On the variance of a class of inductive valuations of data structures for digital search, Theoret. Comput. Sci., 144 (1995), pp. 251–275. [71] W. Schachinger, Asymptotic normality of recursive algorithms via martingale difference arrays, Discrete Math. Theor. Comput. Sci., 4 (2001), pp. 363–397. [72] W. Schachinger, Concentration of size and path length of tries, Combin. Probab. Comput., 13 (2004), pp. 763–793. [73] R. Sedgewick and P. Flajolet, An Introduction to the Analysis of Algorithms, Addison– Wesley, Reading, MA, 1996. [74] V. Srinivasan and G. Varghese, Fast address lookups using controlled prefix expansions, ACM Trans. Comput. Syst., 17 (1999), pp. 1–40. [75] W. Szpankowski, Average complexity of additive properties for multiway tries: A unified approach, in TAPSOFT ’87, Vol. 1 (Pisa, 1987), Lecture Notes in Comput. Sci. 249, SpringerVerlag, Berlin, 1987, pp. 13–25. [76] W. Szpankowski, Some results on V -ary asymmetric tries, J. Algorithms, 9 (1988), pp. 224– 244. [77] W. Szpankowski, On the height of digital trees and related problems, Algorithmica, 6 (1991), pp. 256–277. [78] W. Szpankowski, A generalized suffix tree and its (un)expected asymptotic behaviors, SIAM J. Comput., 22 (1993), pp. 1176–1198. [79] W. Szpankowski, Average Case Analysis of Algorithms on Sequences, Wiley-Interscience, New York, 2001. [80] B. W. Watson, Taxonomies and Toolkits of Regular Language Algorithms, Ph.D. thesis, Department of Mathematics and Computer Science, Eindhoven University of Technology, Eindhoven, The Netherlands, 1995. [81] M. D. Ward and W. Szpankowski, Analysis of a randomized selection algorithm motivated by the LZ’ 77 scheme, in Proceedings of the First Workshop on Analytic Algorithmics and Combinatorics (ANALCO 04), New Orleans, SIAM, Philadelphia, 2004, pp. 153–160. [82] M. D. Ward and W. Szpankowski, Analysis of the multiplicity matching parameter in suffix trees, in Proceedings of the 2005 International Conference on Analysis of Algorithms, C. Mart´ınez, ed., Discrete Mathematics and Theoretical Computer Science, Nancy, France, 2005, pp. 307–321. [83] R. Wong, Asymptotic Approximations of Integrals, SIAM, Philadelphia, 2001 (corrected reprint of the 1989 original).