Thanks to everyone who came here and gave me time.
I read Robert Sedgwick (s ++) 2014, p. 31, Lemma 1.2.
An example of solving a connectivity problem using the fast merge method is given.
for(i = p; i != id[i]; i = id[i]) ; for(j = q; j != id[j]; j = id[j]) ; if(i == j) continue; id[i] = j;
With this, everything is clear, then he writes about the effectiveness of the algorithm:
For M pairs of N objects, when M> N, the solution of the connectivity problem by the fast combining algorithm may require executing more than MN / 2 instructions.
He says about M pairs, are they the right pairs and not the right ones? Those who just come to the input?
Suppose that pairs are entered in the following order (1-2 2-3 3-4) and so on. After entering N-1 such pairs, we get N objects belonging to the same set, and the tree formed by the fast combining algorithm is a straight line, where object N points to object N-1, which, in turn, refers to object N-2, the one on the N-3 and so on. To perform a search operation for an object N, the program must go through the N-1 pointers. Thus, the average number of pointers on which the transitions are performed for the first N pairs is (0 + 1 + ... (N-1)) / N = (N-1) / 2
Why does he find the arithmetic average ?! After all, he says that the list is built (1-2 2-3 3-4) and so on, to go from start to finish you need to go N-1 times. It is not clear that he has entered the "transitions for the first N pairs"?
Now suppose that all other pairs associate an object N with some other object. To perform a search operation for each of these pairs, it is necessary to go at least along N-1 indicators. The grand total for M search operations with such a sequence of input pairs is definitely greater than MN / 2
What does he have to enter "all other pairs", wrong pairs in the input? How did he get the MN / 2?
Maybe I was stupid somewhere, help please.