home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!mips!darwin.sura.net!jvnc.net!phage!wchang
- From: wchang@cshl.org (Bill Chang)
- Newsgroups: comp.theory
- Subject: Re: Algorithm for lowest common ancestor problem
- Message-ID: <1992Aug12.170222.3859@cshl.org>
- Date: 12 Aug 92 17:02:22 GMT
- References: <ARUN.92Aug11192510@bayou22.cacs.usl.edu>
- Sender: news@cshl.org (NO MAIL)
- Organization: Cold Spring Harbor Laboratory
- Lines: 25
-
- B. Schieber and U. Vishkin, On Finding Lowest Common Ancestors: Simplification
- and Parallelization, {\em SIAM J. Comput.} 17:6(1988), pp. 1253--1262.
-
- Linear space and preprocessing of the tree; constant time LCA queries using
- bit magic. I have implemented this algorithm (for string matching; my tree
- is a digital trie). Runs in about 50 simple machine instructions per query.
-
- There is a newer alogorithm
-
- O. Berkman and U. Vishkin, Recursive *-tree Parallel Data-Structure (1989)
-
- which is discussed in Joseph Ja Ja's terrific new book An Intro. to Parallel
- Algorithms (Addison-Wesley 1992).
-
- These methods are based on deep analyses of node numbering given by tree
- traversals. If your tree is not too large, a quadratic space tabulation
- (computed "top-down" so to speak) of all LCA(x,y) may suffice. The simplest
- method is probably to store with each node its distance from the root...
- Next simplest is to number the nodes so a subtree corresponds to an interval
- of numbers... If the tree cannot be preprocessed, compute the paths to the
- root, then compare them starting from the root.
-
- In practice simpler methods may very well be faster :-)
-
- -- Bill Chang (wchang@cshl.org) Cold Spring Harbor Lab., NY
-