Skip to main content

The nearest common ancestor in a dynamic tree

  • Algorithms And Complexity
  • Conference paper
  • First Online:
Book cover Automata, Languages and Programming (ICALP 1987)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 267))

Included in the following conference series:

Abstract

We consider the problem of determining the nearest common ancestor of two given nodes x and y (denoted by nca(x,y)) in a dynamic arbitrary tree T. We present an implementation of T by a pointer machine which needs linear space, performs m arbitrary insertions and deletions in the initially empty tree T in time O(m) and a query about nca(x,y) can be answered on-line in time O(log(min{depth(x), depth(y)})+α(k,k)), where the second factor is amortized over k queries, α is a functional inverse of Ackermann's function and depth(x) the distance from node x to the root of T.

We also consider the static version of the problem and give an optimal pointer machine algorithm which needs O(n) preprocessing time, space O(n) and answers a query on-line in time O(log log n).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. AHO, J. HOPCROFT, J. ULLMAN ”The Design and Analysis of Computer Algorithms”, Addison-Wesley, Reading, MA, 1974

    Google Scholar 

  2. A. AHO, J. HOPCROFT, J. ULLMAN ”On finding Lowest Common Ancestors in Trees”, SIAM Journal of Computing, Vol. 1, No 1, pp. 115–132 (1976)

    Google Scholar 

  3. D.HAREL ”A Linear Time Algorithm for the Lowest Common Ancestors problem”, Proc. 21st IEEE Symposium on Foundations of Computer Science, pp.308–319 (1980)

    Google Scholar 

  4. D. HAREL and R.E. TARJAN ”Fast Algorithms for finding Nearest Common Ancestors”, SIAM Journal of Computing, Vol. 13, pp. 338–355 (1984)

    Google Scholar 

  5. J.v.LEEUWEN ”Finding Lowest Common Ancestors in less than Logarithmic Time”, unpublished report (1976)

    Google Scholar 

  6. D. MAIER ”An Efficient Method for storing Ancestor Information in Trees”, SIAM Journal of Computing, Vol. 8, No 4, pp. 599–618 (1979)

    Google Scholar 

  7. D.SLEATOR and R.E.TARJAN ”A Data Structure for Dynamic Trees”, Journal of Computer and System Science 26, pp. 362–391 (1983)

    Google Scholar 

  8. R.E. TARJAN ”A Class of Algorithms which require non-linear time to maintain Disjoint Sets”, J. Comput. System Sci., 18, pp. 110–127 (1979)

    Article  Google Scholar 

  9. R.E. TARJAN and J. v.LEEUWEN ”Worst-Case Analysis of Set Union Algorithms”, Journal of ACM, Vol. 31, pp. 245–281 (1984)

    Article  Google Scholar 

  10. A.K. TSAKALIDIS ”Maintaining Order in a Generalized Linked List”, Acta Informatica 21, pp. 101–112 (1984)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Thomas Ottmann

Rights and permissions

Reprints and permissions

Copyright information

© 1987 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Tsakalidis, A.K. (1987). The nearest common ancestor in a dynamic tree. In: Ottmann, T. (eds) Automata, Languages and Programming. ICALP 1987. Lecture Notes in Computer Science, vol 267. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-18088-5_42

Download citation

  • DOI: https://doi.org/10.1007/3-540-18088-5_42

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-18088-3

  • Online ISBN: 978-3-540-47747-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics