In this section, we analyze the expected height, size, and length of the search path in a skiplist. This section requires a background in basic probability. Several proofs are based on the following basic observation about coin tosses.
 be the number of times a fair coin is tossed up to and including
  the first time the coin comes up heads.  Then
 be the number of times a fair coin is tossed up to and including
  the first time the coin comes up heads.  Then 
![$ \mathrm{E}[T]=2$](img2243.png) .
.
 
 if and only if the first
 if and only if the first  coin tosses are tails,
  so
 coin tosses are tails,
  so 
![$ \mathrm{E}[I_i]=\Pr\{I_i=1\}=1/2^{i-1}$](img2248.png) .  Observe that
.  Observe that  , the total
  number of coin tosses, can be written as
, the total
  number of coin tosses, can be written as 
 .
  Therefore,
.
  Therefore,
  
| ![$\displaystyle \mathrm{E}[T]$](img2251.png) | ![$\displaystyle = \mathrm{E}\left[\sum_{i=1}^\infty I_i\right]$](img2252.png) | |
| ![$\displaystyle = \sum_{i=1}^\infty \mathrm{E}\left[I_i\right]$](img2253.png) | ||
|  | ||
|  | ||
|  | 
 
The next two lemmata tell us that skiplists have linear size:
 elements,
  not including occurrences of the sentinel, is
 elements,
  not including occurrences of the sentinel, is 
 .
.
 , is included in list
, is included in list
  
 is
 is 
 , so the expected number of nodes in
, so the expected number of nodes in 
 is
  is 
 .4.2  Therefore, the total expected number of nodes in all lists is
.4.2  Therefore, the total expected number of nodes in all lists is
  
 
 
 , 
  define the indicator random variable
, 
  define the indicator random variable
  
 
 , of the skiplist is then given by
, of the skiplist is then given by
  
 
 is never more than the length,
 is never more than the length, 
 , of
, of 
 , so
, so 
  
![$\displaystyle \mathrm{E}[I_{\ensuremath{\mathtt{r}}}] \le \mathrm{E}[\vert L_{\...
...t{r}}}\vert] = \ensuremath{\mathtt{n}}/2^{\ensuremath{\mathtt{r}}} \enspace .
$](img2276.png) 
| ![$\displaystyle \mathrm{E}[\ensuremath{\mathtt{h}}]$](img2277.png) | ![$\displaystyle = \mathrm{E}\left[\sum_{r=1}^\infty I_{\ensuremath{\mathtt{r}}}\right]$](img2278.png) | |
| ![$\displaystyle = \sum_{\ensuremath{\mathtt{r}}=1}^{\infty} E[I_{\ensuremath{\mathtt{r}}}]$](img2279.png) | ||
| ![$\displaystyle = \sum_{\ensuremath{\mathtt{r}}=1}^{\lfloor\log \ensuremath{\math...
...r\log \ensuremath{\mathtt{n}}\rfloor+1}^{\infty} E[I_{\ensuremath{\mathtt{r}}}]$](img2280.png) | ||
|  | ||
|  | ||
|  | 
 
 elements,
  including all occurrences of the sentinel, is
 elements,
  including all occurrences of the sentinel, is 
 .
.
 .  The number of occurrences of
  the sentinel is equal to the height,
.  The number of occurrences of
  the sentinel is equal to the height, 
 , of the skiplist so, by
  Lemma 4.4 the expected number of occurrences of the
  sentinel is at most
, of the skiplist so, by
  Lemma 4.4 the expected number of occurrences of the
  sentinel is at most 
 .
.
  
 .
.
 .  This path starts at the predecessor of
.  This path starts at the predecessor of 
 in
  in  .  At any point in time, if the path can go up a level, then
  it does.  If it cannot go up a level then it goes left.  Thinking about
  this for a few moments will convince us that the reverse search path for
.  At any point in time, if the path can go up a level, then
  it does.  If it cannot go up a level then it goes left.  Thinking about
  this for a few moments will convince us that the reverse search path for
  
 is identical to the search path for
 is identical to the search path for 
 , except that it is reversed.
, except that it is reversed.
The number of nodes that the reverse search path visits at a particular
  level, 
 , is related to the following experiment:  Toss a coin.
  If the coin comes up as heads, then move up and stop. Otherwise, move
  left and repeat the experiment.  The number of coin tosses before
  the heads represents the number of steps to the left that a reverse
  search path takes at a particular level.4.3 Lemma 4.2 tells us
  that the expected number of coin tosses before the first heads is 1.
, is related to the following experiment:  Toss a coin.
  If the coin comes up as heads, then move up and stop. Otherwise, move
  left and repeat the experiment.  The number of coin tosses before
  the heads represents the number of steps to the left that a reverse
  search path takes at a particular level.4.3 Lemma 4.2 tells us
  that the expected number of coin tosses before the first heads is 1.
Let 
 denote the number of steps the forward search path takes at level
 denote the number of steps the forward search path takes at level
  
 that go to the right.   We have just argued that
 that go to the right.   We have just argued that 
![$ \mathrm{E}[S_{\ensuremath{\mathtt{r}}}]\le
1$](img2300.png) .  Furthermore,
.  Furthermore, 
 , since we can't take more steps
  in
, since we can't take more steps
  in 
 than the length of
 than the length of 
 , so
, so
  
![$\displaystyle \mathrm{E}[S_{\ensuremath{\mathtt{r}}}] \le \mathrm{E}[\vert L_{\...
...t{r}}}\vert] = \ensuremath{\mathtt{n}}/2^{\ensuremath{\mathtt{r}}} \enspace .
$](img2304.png) 
 be  the length of the search path for some node,
 be  the length of the search path for some node, 
 , in a
  skiplist, and let
, in a
  skiplist, and let 
 be the height of the skiplist.  Then
 be the height of the skiplist.  Then
  
| ![$\displaystyle \mathrm{E}[S]$](img2308.png) | ![$\displaystyle = \mathrm{E}\left[ \ensuremath{\mathtt{h}} + \sum_{\ensuremath{\mathtt{r}}=0}^\infty S_{\ensuremath{\mathtt{r}}} \right]$](img2309.png) | |
| ![$\displaystyle = \mathrm{E}[\ensuremath{\mathtt{h}}] + \sum_{\ensuremath{\mathtt{r}}=0}^\infty \mathrm{E}[S_{\ensuremath{\mathtt{r}}}]$](img2310.png) | ||
| ![$\displaystyle = \mathrm{E}[\ensuremath{\mathtt{h}}] + \sum_{\ensuremath{\mathtt...
...ensuremath{\mathtt{n}}\rfloor+1}^\infty \mathrm{E}[S_{\ensuremath{\mathtt{r}}}]$](img2311.png) | ||
| ![$\displaystyle \le \mathrm{E}[\ensuremath{\mathtt{h}}] + \sum_{\ensuremath{\math...
...mathtt{n}}\rfloor+1}^\infty \ensuremath{\mathtt{n}}/2^{\ensuremath{\mathtt{r}}}$](img2312.png) | ||
| ![$\displaystyle \le \mathrm{E}[\ensuremath{\mathtt{h}}] + \sum_{\ensuremath{\math...
...or} 1 + \sum_{\ensuremath{\mathtt{r}}=0}^{\infty} 1/2^{\ensuremath{\mathtt{r}}}$](img2313.png) | ||
| ![$\displaystyle \le \mathrm{E}[\ensuremath{\mathtt{h}}] + \sum_{\ensuremath{\math...
...or} 1 + \sum_{\ensuremath{\mathtt{r}}=0}^{\infty} 1/2^{\ensuremath{\mathtt{r}}}$](img2314.png) | ||
| ![$\displaystyle \le \mathrm{E}[\ensuremath{\mathtt{h}}] + \log \ensuremath{\mathtt{n}} + 3$](img2315.png) | ||
|  | 
 
The following theorem summarizes the results in this section:
 elements has expected size
 elements has expected size 
 and the
expected length of the search path for any particular element is at most
 and the
expected length of the search path for any particular element is at most
 .
.