Worst-case Analysis of Set Union Algorithms
Journal of the ACM (JACM)
Data structures and algorithms for disjoint set union problems
ACM Computing Surveys (CSUR)
Revised5 report on the algorithmic language scheme
ACM SIGPLAN Notices
Efficiency of a Good But Not Linear Set Union Algorithm
Journal of the ACM (JACM)
An improved equivalence algorithm
Communications of the ACM
Revised [6] Report on the Algorithmic Language Scheme
Revised [6] Report on the Algorithmic Language Scheme
Hi-index | 0.00 |
The Revised6 Report on Scheme requires its generic equivalence predicate, equal?, to terminate even on cyclic inputs. While the terminating equal? can be implemented via a DFA-equivalence or union-find algorithm, these algorithms usually require an additional pointer to be stored in each object, are not suitable for multithreaded code due to their destructive nature, and may be unacceptably slow for the small acyclic values that are the most likely inputs to the predicate. This paper presents a variant of the union-find algorithm for equal? that addresses these issues. It performs well on large and small, cyclic and acyclic inputs by interleaving a low-overhead algorithm that terminates only for acyclic inputs with a more general algorithm that handles cyclic inputs. The algorithm terminates for all inputs while never being more than a small factor slower than whichever of the acyclic or union-find algorithms would have been faster. Several intermediate algorithms are also presented, each of which might be suitable for use in a particular application, though only the final algorithm is suitable for use in a library procedure, like equal?, that must work acceptably well for all inputs.