skip to main content
10.1145/800061.808753acmconferencesArticle/Chapter ViewAbstractPublication PagesstocConference Proceedingsconference-collections
Article
Free Access

A linear-time algorithm for a special case of disjoint set union

Published:01 December 1983Publication History

ABSTRACT

This paper presents a linear-time algorithm for the special case of the disjoint set union problem in which the structure of the unions (defined by a “union tree”) is known in advance. The algorithm executes an intermixed sequence of m union and find operations on n elements in 0(m+n) time and 0(n) space. This is a slight but theoretically significant improvement over the fastest known algorithm for the general problem, which runs in 0(mα(m+n, n)+n) time and 0(n) space, where α is a functional inverse of Ackermann's function. Used as a subroutine, the algorithm gives similar improvements in the efficiency of algorithms for solving a number of other problems, including two-processor scheduling, the off-line min problem, matching on convex graphs, finding nearest common ancestors off-line, testing a flow graph for reducibility, and finding two disjoint directed spanning trees. The algorithm obtains its efficiency by combining a fast algorithm for the general problem with table look-up on small sets, and requires a random access machine for its implementation. The algorithm extends to the case in which single-node additions to the union tree are allowed. The extended algorithm is useful in finding maximum cardinality matchings on nonbipartite graphs.

References

  1. 1.A.V. Aho, J.E. Hopcroft, J.D. Ullman The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, Mass., 1974. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2.A.V. Aho, J.E. Hopcroft, J.D. Ullman, "On finding lowest common ancestors in trees," SIAM J. Comp. 5 (1976), pp. 115-132.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3.E.W. Dijkstra, A Discipline of Programming, Prentice-Hall, Englewood Cliffs, New Jersey, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4.J. Doyle and R.L. Rivest, "Linear expected time of a simple union-find algorithm," Inf. Proc. Letters 5, 1976, pp. 146-148.Google ScholarGoogle ScholarCross RefCross Ref
  5. 5.G.N. Frederickson, "Scheduling unit-time tasks with integer release times and deadlines," Tech. Rept. CS-81-27, Dept. of Computer Sci., Penn. State Univ., University Park, PA, 1982.Google ScholarGoogle Scholar
  6. 6.H.N. Gabow, "An efficient implementation of Edmonds' algorithm for maximum matching on graphs," J. ACM 23 (1976) pp. 221-234. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7.H.N. Gabow, "A linear-time recognition algorithm for interval dags," Inf. Proc. Letters 12 (1981), pp. 20-22.Google ScholarGoogle ScholarCross RefCross Ref
  8. 8.H.N. Gabow, "An almost-linear algorithm for two-processor scheduling," J. ACM, 29, 3 (1982), pp. 766-780. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9.J.R. Gilbert and D.J. Rose, "A separator theorem for chordal graphs," Tech. Rept. TR 82-523, Dept. of Comp. Sci., Cornell Univ., Ithaca, New York, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10.H.N. Gabow and R.E. Tarjan, "A linear-time algorithm for a special case of disjoint set union," Bell Laboratories Report, July 1982.Google ScholarGoogle Scholar
  11. 11.D. Harel, "A linear time algorithm for the least common ancestors problem," Proc. 21st Annual Symp. on Found. Comp. Sci. (1980), pp. 308-319.Google ScholarGoogle Scholar
  12. 12.B. Havens, "Experiments on an asymptotically optimum, special purpose set merging algorithm," M.S. Thesis, Dept. of Computer Sci., Univ. of Colorado, Boulder, CO, 1983.Google ScholarGoogle Scholar
  13. 13.E. Horowitz, and S. Sahni, Fundamentals of Computer Algorithms, Computer Science Press, Potomac, MD, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 14.D. Harel, R.E. Tarjan, "Fast algorithms for finding nearest common ancestors," SIAM J. Comput., submitted. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15.J.E. Hopcroft and J.D. Ullman, "Set merging algorithms," SIAM J. Comput. 2, 4, 1973, pp. 294-303.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16.D.E. Knuth and A. Schonhage, "The expected linearity of a simple equivalence algorithm," Theoretical Comp. Sci. 6 (1978), pp. 281-315.Google ScholarGoogle ScholarCross RefCross Ref
  17. 17.W. Lipski, Jr. and F.P. Preparata, "Efficient algorithms for finding maximum matchings in convex bipartite graphs and related problems," Acta Informatica 15 (1981), pp. 329-346.Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18.T. Lengauer and R.E. Tarjan, "A fast algorithm for finding dominators in a flowgraph," ACM Trans. on Prog. Lang. and Systems 1, 1, 1979, pp. 121-141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 19.S. Micali, private communication, May 1982.Google ScholarGoogle Scholar
  20. 20.S. Micali, and V.V. Vazirani. "An 0(@@@@ E) algorithm for finding maximum matching in general graphs," Proc. 21st Annual Symp. on Found. of Comp. Sci. (1980), pp. 17-27.Google ScholarGoogle Scholar
  21. 21.C.H. Papadimitriou and M. Yannakakis, "Scheduling interval-ordered tasks," SIAM J, Comput. 8, 3, 1979, pp. 405-409.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22.F.P. Preparata and W. Lipski Jr., "Three layers are enough," Proc. 23rd Annual Symp. on Foundations of Comp. Sci., 1982, pp. 350-357. Also personal communication, F.P. Preparata.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23.R. Sethi, "Scheduling graphs on two processors," SIAM J. Comp. 5 (1976), pp, 73-82.Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 24.R.E. Stearns and D.J. Rosenkrantz, "Table machine simulation." Proc. 10th Annual Symp. on Switching and Automata Theory, 1969, pp. 118-128.Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. 25.R.E. Tarjan, "Testing flow graph reducibility," J. Comp. Sys. Sci 9 (1974), pp. 355-365.Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 26.R.E. Tarjan, "Efficiency of a good but not linear set union algorithm," J. ACM 22 (1975), pp. 215-225. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 27.R.E. Tarjan, "Edge-disjoint spanning trees and depth-first search," Acta Informatica 6 (1976), pp. 171-185.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 28.R.E. Tarjan, "Applications of path compression on balanced trees," J. ACM 26, 4 (1979), pp. 690-715. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. 29.R.E. Tarjan, "A class of algorithms which require non-linear time to maintain disjoint sets," J. Comp. Sys. Sci. 18 (1979), pp. 110-127.Google ScholarGoogle ScholarCross RefCross Ref
  30. 30.J.E. Thornton, Design of a computer: The Control Data 6600, Scott, Foresman and Co., Glenview, Illinois, 1970. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 31.R.E. Tarjan, J. van Leeuwen, "Worst-case analysis of set union algorithms," J. ACM, submitted. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A linear-time algorithm for a special case of disjoint set union

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          STOC '83: Proceedings of the fifteenth annual ACM symposium on Theory of computing
          December 1983
          487 pages

          Copyright © 1983 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 December 1983

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Overall Acceptance Rate1,469of4,586submissions,32%

          Upcoming Conference

          STOC '24
          56th Annual ACM Symposium on Theory of Computing (STOC 2024)
          June 24 - 28, 2024
          Vancouver , BC , Canada

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader