## 1 Conflict Resolutions

Consider the R program:

where the integer is initially , the list is initially for simplicity’s sake, and is the built-in R unbiased random Bernoulli generator. Figure 1 exhibits a sample binary tree for . The first round of coin tosses yields , where and , and thus , . On the left side, focusing on only, the next round of tosses yields and thus , . On the right side, focusing on only, the next round of tosses yields and thus , . Also, focusing on only, the next round of tosses yields and thus , . Termination occurs at the next level: any twig of the tree ceases to grow when its leaf contains items. The number of vertices (including empty vertices) is . We write . The labeled ordering of vertices is determined by watching increase, from to , as the algorithm progresses. Smaller values of occur on the left side because recursive splitting starts with , , … and thereafter continues with , , , ….

The probability generating function for

, given , is likewise recursive [3]:Note that always. Differentiating with respect to :

we have first moment

that is,

where and . Clearly and . Differentiating again:

we have second factorial moment

that is,

where and . Clearly and

. Finally, we have variance

which is when and when .

Such recursions are helpful for small , but give no asymptotic information as . It can be proved that [4, 5]

where is a periodic function of period with tiny amplitude and zero mean, for , . Functions like these appear throughout the analysis of algorithms. We shall not specify these here nor later, but merely indicate their presence when required. An infinite series representation of the mean for arbitrary is [6, 7]

Also, the constant (one-quarter of the variance as ) appears in [8, 9, 10].

## 2 Leader Elections

Two parameters are examined in this section: height (length of the root-to-leaf path that gives the leader) and size (number of vertices in the associated weakly binary tree). We further discuss a variation of the election in which draws (involving exactly two competitors) constitute an additional way to stop the process.

### 2.1 Height

Consider the R program:

where the integer is initially (unlike before) and the list is initially . Figure 2 exhibits a sample binary tree for . The first round of coin tosses yields , where and , and thus , . Focusing on only, the next round of tosses yields and thus , . Note that we do not indicate nor count the empty vertex. Focusing on only, the next round of tosses yields and thus , . Focusing on only, the next round of tosses yields and thus , . Focusing on only, the next round of tosses yields and thus , . Termination occurs at the next level: the leftmost twig of the tree contains exactly item. The height (number of steps separating the vertices labeled and ) is . We write .

The probability generating function for , given , is [11]:

Note that always. Differentiating with respect to :

we have first moment

that is,

where and . Clearly and . Differentiating again:

we have second factorial moment

that is,

where and . Clearly and . Finally, we have variance which is when and when .

### 2.2 Size

Consider the R program:

where the integer is initially and the list is initially . Figure 3 is almost identical to Figure 2 – it contains the same binary tree for – but the labeling is different. The number of vertices (excluding empty vertices) is . We write . The labeled ordering of vertices is determined by watching increase, from to , as the algorithm progresses. We sweep across the tree horizontally (in rows) rather than hierarchically. In particular, the command

increases by if both vertices are non-empty and by only if otherwise.

The probability generating function for , given , is [11]:

Note that always. Differentiating with respect to :

we have first moment

that is,

where and , . Clearly and . Differentiating again:

we have second factorial moment

that is,

where and . Clearly and . Finally, we have variance which is when and when .

We wonder about the cross-covariance of and , whose calculation would require a bivariate generating function.

### 2.3 Draws

Let us alter the rules so that a draw between two persons is allowed (if precisely two persons are left, then they both are declared leaders). The third line of the two preceding R programs is simply replaced by

and the initial conditions of the two preceding recurrences are also changed. For height, we now have (implying and (implying ); thus

For size, we now have , (implying and (implying ); thus

It would seem that the fraction given within the formula for in [11] is incorrect and should be instead.

## 3 Coin Tosses

Before moving on to more complicated examples, it may be worthwhile to contemplate the most elementary recursive program imaginable:

mentioned at the end of [17], where is initially . Note that the third line here is

unlike what we have seen before. People iteratively toss all coins which show tails until only heads are visible. Omitting details, it follows that the procedural height has generating function

therefore

where (implying , , and (implying , , ). From this [18]

as .

## 4 Finding the Maximum

Consider the R program:

where the integer is initially and the list is initially . We find a comparison of a conflict resolution tree in Figure 4 and its corresponding maximum-finding tree in Figure 5 to be helpful. Note that the vertex count for the latter is only , which is less than the vertex count of determined for the former. The discrepancy arises because, at the instant the vertex becomes the leader and consequently increases from to , both the vertex becomes empty and the & vertices are reduced to . It follows that the vertex is reduced to , which cannot have any descendants, eliminating two twigs. Also, increases from to and, subsequently, from to ; while the penultimate vertex becomes empty, this does not further alter the count. We write .