Efficient equality-testing and updating of sets

  • Tak Wah Lam
  • Ka Hing Lee
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1023)


This paper is concerned with data structures and algorithms for managing an arbitrary number of sets such that we can dynamically update each individual set and test whether any two sets are equal. Previous schemes can support set equality-testing in constant time and an update operation (i.e. insert or delete an element) in time O(log2m) [7, 5] or O(log m log*m) [2], where m is the number of insert operations performed. Note that m is an upper bound of n, the total size of the sets, but maybe a loose one. When we have performed a lot of delete operations, having few elements left in the sets, it is natural to expect the operations to be performed faster. Yet existing schemes are not favored when n is much smaller than m. It is desirable to have a scheme whose performance is in terms of n instead of m.

This paper presents a new scheme which is more dynamic in nature and supports each insert or delete operation in O(log n) time, while maintaining the constant time complexity of set equality-testing.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A.V. Aho, J.E. Hopcroft, and J.D. Ullman, The Design and Analysis of Computer Algorithms, Ex 2.12, 71.Google Scholar
  2. [2]
    T.W. Lam and K.H. Lee, On Set Equality-Testing, Proceedings of the 2nd Italian Conference on Algorithms and Complexity, 1994, 179–191.Google Scholar
  3. [3]
    W. Pugh and T. Teitelbaum, Incremental Computation via Function Caching, Proceedings of the Sixteenth ACM Symposium on Principles of Programming Languages, 1989, 315–328.Google Scholar
  4. [4]
    M. Sassa and E. Goto, A Hashing Method for Set Operations, Information Processing Letters, 5, 1976, 265–279.Google Scholar
  5. [5]
    R. Sundar and R.E. Tarjan, Unique Binary Search Tree Representations and Equality Testing of Sets and Sequences, Proceedings of the Twenty-second Annual ACM Symposium on Theory of Computing, 1990, 18–25.Google Scholar
  6. [6]
    M.N. Wegman and J.L. Carter, New Hash Functions and Their Use in Authentication and Set Equality, Journal of Computer and System Sciences, 22, 1981, 265–279.Google Scholar
  7. [7]
    D.M. Yellin, Representing Sets with Constant Time Equality Testing, Journal of Algorithms, 13, 1992, 353–373; a preliminary version appeared in the Proceedings of the First Annual ACM-SIAM Symposium on Algorithms, 1990, 64–73.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Tak Wah Lam
    • 1
  • Ka Hing Lee
    • 1
  1. 1.Department of Computer ScienceUniversity of Hong KongHong Kong

Personalised recommendations