....An optimal solution is known since the 70s. It is attributed to McIlroy and Morris [3] and its complexity was analyzed byTarjan [17]2. It is a classic of the algorithmic literature (see for instance =-=[11]-=- chapter 22). The code of this solution is given inappendix. The main idea is to link together the elements of each class. For this purpose, the array parent maps each integer i toanother integer of t...

...assistant [1, 6] to show both the correctness of our solution and its observational persistence.There are known techniques to design persistent data structures based on purely applicative programming =-=[14]-=- but there isno efficient solution to the union-find problem in this framework. There are also techniques to make imperative data structures per-sistent [12] but, again, they were not applied to the u...

...usion of persis-tence. 3. Performance We tried to test the efficiency of our solution in a situation asrealistic as possible. For this purpose we looked at the use made by the Ergo decision procedure =-=[8]-=- of its internal union-find datastructure. We distinguish three parameters: * the number of backtracks; * the total number of find and union operations between twobranchings, denoted N;* the proportio...

...ure (the data is made invalid when wedo the backtrack) but it would be even more efficient if we checked statically the legal use of this semi-persistence. Such a static anal-ysis is work in progress =-=[9]-=-. A. Imperative Union-Find Algorithm The following code implements the optimal imperative solution forunion-find, as described in the introduction. The data structure is a record containing two arrays...

...peration merges two classes of the partition, thedata structure being modified in place (hence the return type unit).An optimal solution is known since the 70s. It is attributed to McIlroy and Morris =-=[3]-=- and its complexity was analyzed byTarjan [17]2. It is a classic of the algorithmic literature (see for instance [11] chapter 22). The code of this solution is given inappendix. The main idea is to li...

... very simpleway to improve this first implementation. 2.3.2 A Major Improvement To lower the cost of operations on previous versions of persistentarrays, H. Baker introduces a very simple improvement =-=[5]-=-: as soon as we try to access a persistent array which is not an immediatearray we first reverse the linked list leading to the Arr node, tomove it in front of the list, that is precisely where we wan...