The set union problem with backtracking

  • Heikki Mannila
  • Esko Ukkonen
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 226)


The classical set union problem is to manipulate a partition of U = {1,2,...,n} under the operations find and union. We study a variant of this problem, where backtracking over the union operations is possible with the deunion operation. An implementation is developed to on-line perform an intermixed sequence of m finds, k unions and at most k deunions in O((m+k) log log n) steps. An O(k + m log n) method is also given. The problem considered is motivated by questions arising in the implementation of the programming language Prolog.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [GT83].
    H.N.Gabow and R.E.Tarjan: A linear-time algorithm for a special case of disjoint set union. Proceedings of the 15th ACM Symposium on Theory of Computing (1983), 246–251.Google Scholar
  2. [Ho84].
    C.J.Hogger: Introduction to Logic Programming. Academic Press, 1984.Google Scholar
  3. [MU86].
    H.Mannila and E.Ukkonen: On the complexity of unification sequences. Third International Conference on Logic Programming, London, July 14–18, 1986, to appear.Google Scholar
  4. [Ta75].
    R.E. Tarjan: Efficiency of a good but not linear disjoint set union algorithm. J.ACM 22, 2 (April 1975), 215–225.Google Scholar
  5. [Ta79].
    R.E. Tarjan: A class of algorithms which require nonlinear time to maintain disjoint sets. J. Computer and System Sciences 18 (1979), 110–127.Google Scholar
  6. [Ta85].
    R.E. Tarjan: Amortized computational complexity. SIAM J. Alg. Disc. Meth. 6 (1985), 306–318.Google Scholar
  7. [TvL84].
    R.E. Tarjan and J. van Leeuwen: Worst-case analysis of set union algorithms. J.ACM 31, 2 (April 1984), 245–281.Google Scholar
  8. [vLvW77].
    J. van Leeuwen and T. van der Weide: Alternative path compression techniques. Techn. Rep. RUU-CS-77-3, Rijksuniversiteit Utrecht, Utrecht, The Netherlands.Google Scholar
  9. [WP77].
    D.H.D. Warren and L.M. Pereira: Prolog — the language and its implementation compared with LISP. ACM SIGPLAN Notices 12, 3 (August 1977), 109–115.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1986

Authors and Affiliations

  • Heikki Mannila
    • 1
  • Esko Ukkonen
    • 1
  1. 1.Department of Computer ScienceUniversity of HelsinkiHelsinkiFinland

Personalised recommendations