Fact-checked by Grok 2 weeks ago

Lowest common ancestor

In and , the lowest common ancestor (LCA) of two s u and v in a rooted T is the deepest in T that has both u and v as descendants, meaning the farthest from the that lies on the paths from the to u and from the to v. This is unique in trees due to their structure, which ensures a single path between any two s via their common ancestors. The LCA problem involves preprocessing a (or more generally, a , or DAG) to efficiently answer queries for the LCA of any pair of nodes, a task that has been recognized as fundamental since the late . Early work by introduced offline algorithms for computing LCAs using techniques like path compression and union-find structures, achieving linear time for multiple queries. Subsequent developments, such as those by Harel and Tarjan, provided online algorithms with linear preprocessing and constant-time queries, though the original method was complex. These were later simplified to linear preprocessing and constant query time via reductions to the range minimum query (RMQ) problem. In DAGs, the LCA is generalized to a set of maximal common ancestors, as multiple such nodes may exist without a unique deepest one. LCAs find broad applications in areas requiring hierarchical analysis, including compiler design for optimizing , for resolving hierarchies, and modeling complex systems like lattices or in . They also appear in for analysis and in for scene partitioning into hierarchical structures. Modern extensions address dynamic trees, where nodes are inserted or deleted, maintaining efficient query performance through advanced data structures like heavy-light decomposition or Euler tour techniques combined with segment trees.

Fundamentals

Definition

A rooted tree is a connected acyclic with a designated from which all other s are reachable via directed s away from the , establishing a hierarchical structure of -child relationships. In such a tree, each except the has exactly one , and the depth of a is defined as the length of the unique from the to that . An of a v is any on the from the to v, inclusive of the and v itself; conversely, v is a of any such . The (LCA) of two s u and v in a rooted is the deepest that has both u and v as , meaning it is the common farthest from the root. If one is an of the other, the LCA is that itself. This definition assumes the tree is rooted and that u and v are distinct s in the . To illustrate, consider a simple rooted with root R, children A and D under R, and grandchildren B and C under A:
    R
   / \
  A   D
 / \
B   C
The LCA of B and C is A, as A is the deepest ancestral to both. The LCA of B and D is .

Properties

In a rooted , the lowest common ancestor (LCA) of any two nodes u and v is unique, as the ensures a single path connecting u and v, thereby defining a single deepest common ancestor. The LCA of u and v, denoted \mathrm{LCA}(u, v), is by definition an of both nodes and possesses the maximum depth among all common ancestors, where depth measures distance from the . Consequently, if \mathrm{LCA}(u, v) = u, then u is an of v. The relation is symmetric, with \mathrm{LCA}(u, v) = \mathrm{LCA}(v, u), and ancestry itself exhibits : if w = \mathrm{LCA}(u, v) and v is an of x, then \mathrm{LCA}(u, x) lies on the path from w to x. A key depth relation governs the tree distance \mathrm{dist}(u, v) between u and v: \mathrm{dist}(u, v) = \mathrm{depth}(u) + \mathrm{depth}(v) - 2 \cdot \mathrm{depth}(\mathrm{LCA}(u, v)) This equation derives from the shared path prefix up to the LCA, with the remaining paths diverging downward. Rearranging yields the equivalent form \mathrm{depth}(\mathrm{LCA}(u, v)) + \mathrm{dist}(u, v) = \mathrm{depth}(u) + \mathrm{depth}(v). In binary trees, the paths from the to u and v coincide until the LCA, at which point they diverge into distinct child subtrees.

Algorithms for Trees

Naive and Simple Methods

One straightforward approach to computing the lowest common ancestor (LCA) of two nodes u and v in a rooted tree involves traversing the paths from u and v upward to the and identifying the deepest common to both paths. This can be implemented by first computing the list of ancestors for each by following pointers until reaching the , then iterating through the lists from the downward to find the last matching . Assuming pointers are precomputed in O(n) time via a , each query requires O(n) time in the worst case, as path lengths can be up to n in a skewed tree. A variant of this method first determines the depths of u and v (precomputable in O(n) time) and moves the deeper upward to match the depth of the shallower one, then advances both nodes simultaneously toward the until they coincide, which is the LCA. This also takes O(n) time per query, as the total upward traversals are bounded by the tree height, which is O(n) in the worst case. Another simple technique uses ancestor marking: starting from the deeper of u or v, mark all nodes on its path to the (using a array or set, requiring O(n) space per query), then traverse upward from the other , stopping at the first marked , which is the LCA. With precomputed depths, this achieves O(n) time and O(n) auxiliary space per query, making it suitable for trees where temporary storage is available but repeated full traversals are undesirable. For scenarios with many queries, a naive preprocessing strategy precomputes the LCA for all pairs of nodes by running the path traversal method for each pair, resulting in O(n^3) preprocessing time and O(n^2) space to store the results in a table, with O(1) query time thereafter. This approach is feasible only for small n, as the quadratic space and cubic time become prohibitive for large s. A basic preprocessing method without advanced data structures involves recording an Euler tour of the during a depth-first traversal, along with the depth of each position in the tour and the first occurrence time of each . For a query on u and v, locate their first occurrences at positions i and j (with i < j), then scan the subarray from i to j to find the position with minimum depth; the at that position is the LCA, provided it is an of both (verifiable in time). Preprocessing takes O(n) time and space for the tour (of length O(n)), but each query requires O(n) time to scan the range. These methods, while conceptually simple and requiring minimal preprocessing, exhibit significant limitations for practical use on large trees or with numerous queries. The per-query time of O(n) leads to overall costs of O(qn) for q queries, which is inefficient when q is large (e.g., q = \Theta(n)), and the all-pairs approach demands excessive space and time that scale poorly beyond modest tree sizes. They serve primarily as baselines for understanding more efficient techniques but are rarely used in production systems handling substantial data.

Reduction to Range Minimum Query

The reduction of the lowest common ancestor (LCA) problem to a range minimum query (RMQ) leverages the to transform the tree structure into a linear where LCA queries correspond to finding the minimum depth in a specific range. This approach, first proposed by Harel and Tarjan, enables constant-time LCA queries after linear preprocessing by preprocessing the RMQ structure on the resulting . To apply the reduction, perform a (DFS) traversal of the tree, constructing an Euler tour E that records each visit. Specifically, during the DFS, append a 's identifier to E each time it is entered or exited (except the root's final exit), resulting in a of $2n-1 for an n- tree. Alongside E, maintain a depth D where D is the depth of the E (with the root at depth 0). Additionally, compute the first occurrence index \mathrm{first} for each v as its initial position in E. This preprocessing step takes O(n) time and space. For an LCA query on nodes u and v, assume that \mathrm{first} < \mathrm{first}. The LCA is the E at the k in [\mathrm{first}, \mathrm{first}] where D is minimized, as this position corresponds to the deepest common in the tour between the first visits to u and v. Thus, the query reduces to an RMQ on D to find the minimum in the range [\mathrm{first}, \mathrm{first}], followed by a lookup to identify the . With a suitable RMQ supporting O(1) queries after O(n) or O(n \log n) preprocessing, the overall LCA query time is constant. Bender and Farach-Colton refined this method for practicality, emphasizing a simple O(n) preprocessing scheme using the Euler tour and a sparse for RMQ, achieving O(1) query time while using O(n \log n) space. Their approach avoids complex tree decompositions, making it suitable for implementation in software libraries and contexts. This reduction highlights the between LCA and RMQ problems, as both admit linear-space, constant-time solutions, and has influenced subsequent work on succinct data structures for trees.

Constant-Time RMQ Solution

The constant-time range minimum query (RMQ) solution provides a foundational approach for achieving O(1) lowest common ancestor (LCA) queries in trees after O(n) preprocessing time and space, building on the reduction of LCA to RMQ via the . While earlier methods such as Cartesian trees or standard sparse tables enable constant-time RMQ, they often require superlinear space, such as O(n log n). The Bender-Farach-Colton method addresses this by achieving linear space through a block-based decomposition combined with succinct data structures, allowing efficient RMQ on an array of size n. In the preprocessing , the input is partitioned into non-overlapping s of s = \frac{1}{2} \log_2 n. For each , the minimum values and their positions are precomputed to support fast intra-block queries, using normalized tables that ensure constant-time access within O(s) space per . An auxiliary is then constructed from the block minima, which is preprocessed using a sparse table to answer range minimum queries across blocks in constant time; this sparse table exploits the reduced of the auxiliary (O(n / s)) to maintain overall linear space. The entire preprocessing runs in O(n) time by leveraging efficient construction of these structures, with succinct representations (such as bit vectors for positions) ensuring the total space remains O(n). To answer an RMQ between indices i and j, the method identifies the blocks containing i and j, resolves the partial blocks at the ends using the precomputed intra-block minima, and handles any intervening full blocks by querying the sparse table on the block minima array to find the overall minimum block, followed by retrieving its position. This process completes in O(1) time, as each step involves a constant number of table lookups. Applying this RMQ solution to LCA, the Euler tour of the tree produces an array of depths where the LCA of two nodes corresponds to the position of the minimum depth between their first occurrences in the tour. Preprocessing this depth array with the Bender-Farach-Colton method in O(n) time and space thus enables O(1) LCA queries, where the RMQ returns the index of the LCA in the tour, which can then be mapped back to the node.

Block-Based Case Analysis

In the constant-time range minimum query (RMQ) solution for lowest common ancestor preprocessing, the array derived from the tree's Euler tour is partitioned into blocks of size s \approx \frac{\log n}{2}, where n is the array length; this choice balances the preprocessing time and space requirements, ensuring overall O(n) space and time while enabling O(1) queries. The block size limits the number of distinct block configurations to approximately $4^s, allowing efficient precomputation of RMQ structures for all possible blocks via their representations, which are stored in a . For an RMQ query between positions i and j (with i \leq j), the handling depends on whether i and j lie in the same or different blocks, leveraging precomputed minima within blocks and a sparse table over the sequence of block minima. In the case where i and j are in the same , the query reduces to a direct lookup in the precomputed RMQ for that , which is isomorphic to its and supports constant-time resolution. When i and j reside in different blocks, the query decomposes into three subranges: the of the block containing i (from i to the block's end), the full blocks strictly between the two blocks, and the of the block containing j (from the block's start to j). The minimum position is then determined by computing the RMQ for each subrange—the and using the block-specific precomputed structures, and the inter-block range using the sparse table on block minima—and selecting the overall minimum among the three resulting positions. This process ensures constant time, as each component query is O(1). Edge cases arise when the range spans a single block (handled as the same-block case) or adjacent blocks (where the inter-block subrange is empty, reducing to just the suffix-prefix combination across the block boundary). In such scenarios, the method avoids unnecessary computations by directly applying the block RMQ structures or skipping the sparse table lookup, maintaining the O(1) bound without additional overhead.

Extensions

To Directed Acyclic Graphs

In directed acyclic graphs (DAGs), the lowest common ancestors (LCAs) of two s u and v form the set of nodes that have directed paths to both u and v, and are maximal under the ancestry partial order, meaning no other common ancestor is reachable from them. This generalizes the tree case, where the LCA is always unique, but in DAGs, the set may be empty, contain a single node, or include multiple incomparable nodes. A key challenge in DAGs is the potential non-uniqueness of LCAs, which requires algorithms to either compute the entire set or select a representative, such as the one at minimum depth or an arbitrary maximal element. For example, consider a DAG with nodes 1 and 2 as sources, where edges exist from 1 to 3 and 4, and from 2 to 3 and 4; querying the LCAs of 3 and 4 yields both 1 and 2, as each reaches both targets but neither reaches the other. In contrast, a would merge such paths at a single . Simple query-time algorithms compute LCAs by reversing the edge directions, performing (DFS) from u and v to mark ancestors, identifying the intersection of marked nodes, and selecting maximal elements in the (e.g., nodes with out-degree zero in the original direction among common ancestors), achieving O(n + m) time per query where n is the number of nodes and m the number of edges. For efficient repeated queries, preprocessing methods enable faster responses; one approach reduces representative LCA computation to all-pairs shortest paths or , yielding O(n^{2.688}) preprocessing time and O(1) query time for a representative LCA. Alternative techniques, such as dynamic programming on a transitive of the DAG, support all LCAs in O(n m_r) preprocessing where m_r is the number of edges in the reduction, with query time O(k) where k is the output size, or O(n^{2.575}) total time for all-pairs representative LCAs using fast rectangular . Space-time tradeoffs in DAG LCA algorithms often rely on partial transitive closures or path decompositions to avoid full O(n^2) space; for instance, path cover methods decompose the DAG into w paths where w is the pathwidth, enabling O(w n^2 \log n) preprocessing and O(w \log n) query time while using O(w n \log n) space, which is linear when w = O(1). These linear-space approaches contrast with denser methods requiring quadratic storage for complete ancestor relations.

To Other Structures

In partially ordered sets (posets), the lowest common ancestor generalizes to the meet operation when the poset forms a , defined as the greatest lower bound of two elements, which serves as the deepest common predecessor under the partial order. This analogy arises because, in the transitive closure of the poset represented as a , the meet corresponds to the least common ancestor of the two elements. Computation of meets in such structures often leverages order ideals, where the poset of all order ideals of a given poset itself forms a distributive , allowing efficient determination of meets and joins through set operations on ideals. For dynamic trees, where the structure undergoes insertions and deletions via link and cut operations, link-cut trees provide a framework for maintaining LCA queries efficiently. These trees, based on splay trees, support link, cut, and LCA operations in amortized O(log n) time per operation, enabling dynamic maintenance of forest structures while preserving ancestor relationships. Heavy-light decomposition can complement this by partitioning the tree into paths for faster path queries, achieving similar O(log n) bounds for updates and LCA computations in dynamic settings. Euler tour techniques, represented as trees, also facilitate O(log n) LCA queries under dynamic changes by flattening the tree into a sequence for range queries. In binary search trees, the ordered nature simplifies LCA computation without preprocessing. Starting from the , the algorithm traverses based on comparisons: if both nodes are less than the current node, recurse left; if both greater, recurse right; otherwise, the current node is the LCA. This yields O(h) , where h is the tree height, leveraging the BST invariant that left subtrees contain smaller values and right larger ones. Approximate variants of LCA arise in hierarchical structures where exact ancestry is noisy or approximate, such as in taxonomic or clustering hierarchies; here, near-LCA computations identify nodes within a bounded depth error from the true LCA to handle inexact relationships efficiently. Limitations emerge when extending LCA to general graphs, where multiple paths between nodes can violate uniqueness, and defining a "lowest" common ancestor often requires additional metrics like depth or shortest paths, leading to increased computational hardness; for instance, finding LCAs for k nodes (k ≥ 3) in directed acyclic graphs is NP-hard, and the problem intensifies in cyclic general graphs.

Historical Development

Early Concepts

The of the lowest common ancestor (LCA) in trees draws from early ideas in and tree structures, with conceptual roots in biological during the 1960s. Phylogenetic trees, used to represent evolutionary relationships among , inherently involved identifying common ancestors as the branching points farthest from the that connect two taxa. This of shared ancestry in hierarchical structures provided an intuitive foundation for later computational interpretations, though explicit algorithms for computing such ancestors were not yet developed in . Seminal work by Edwards and Cavalli-Sforza in introduced maximum likelihood methods for inferring phylogenetic trees from genetic data, emphasizing the role of common ancestors in modeling divergence, but without formal computational queries for their lowest positions. In , early connections emerged through optimization and analysis in the early 1970s. Dominator trees, which identify s in a program's that dominate (i.e., are ancestors of) all paths to a given , closely parallel LCA computations and were pivotal for optimizations like . Initial explorations of dominators appeared in work by Allen and Cocke in 1972, who developed techniques to compute dominator relations iteratively across graph s, laying groundwork for tree-based representations. These methods relied on simple path traversal from entry points, effectively seeking common ancestors in the flow graph's , though not yet termed LCA. The first formal definition and algorithmic treatment of the LCA problem in trees came from Aho, Hopcroft, and Ullman in 1973, motivated by applications in tree pattern matching for syntax analysis and code generation in compilers. Their work framed LCA queries as finding the deepest shared ancestor of two nodes in a rooted tree, proposing initial solutions including naive upward traversals along paths to the root—comparing depths and backtracking to the divergence point—and more structured preprocessing for repeated queries. This built directly on dominator computations, showing how LCA could efficiently determine immediate dominators in reducible flow graphs via on-line algorithms. By 1974, Aho, Hopcroft, and Ullman explicitly integrated LCA into broader graph algorithms, highlighting its utility in transitive closure and optimization problems within their textbook on algorithm design. These early formulations emphasized conceptual simplicity over efficiency, setting the stage for subsequent refinements while establishing LCA as a core primitive in tree-based data processing.

Key Advancements

The 1980s marked significant progress in LCA computation with the introduction of algorithms and the key linkage to the range minimum query (RMQ) problem. Harel and Tarjan in 1984 provided an achieving O(1) query time after O(n log n) preprocessing by reducing LCA to RMQ. In 1988, Schieber and Vishkin presented a simplified for LCA queries that achieves constant-time responses after linear preprocessing, while also enabling efficient computation using a PRAM model with O(n / log n) processors. Their approach built on prior work by reducing complexity without sacrificing asymptotic performance, paving the way for practical implementations. The and early focused on optimizing the RMQ-LCA connection for better space and time efficiency. and Farach-Colton in 2000 refined this with a simple -space, -query solution using a reduced and sparse tables, making constant-time LCA accessible without excessive overhead. The saw innovations in succinct representations and dynamic settings, optimizing space and adaptability. For dynamic trees, Alstrup, Gørtz, and Rauhe () introduced algorithms supporting updates and level ancestor queries (a of LCA) in O(log n) time per operation with O(n log n) space, using heavy-light decomposition. Sadakane and Navarro (2007) advanced succinct data structures, representing ordinal trees in 2n + o(n) bits while supporting LCA in constant time via balanced parentheses and auxiliary RMQ structures. Post-2010 developments have explored quantum accelerations for LCA-related problems. In 2020, Lingas presented quantum algorithms for the maximum witness problem in DAGs, achieving improved time bounds for all-pairs LCA variants using Grover's search integrated with classical preprocessing. These address gaps in dynamic and parallel methods by supporting updates in sublinear time and distributed querying. Key seminal publications include:

Applications

In Computer Science

In computer science, the lowest common ancestor (LCA) finds extensive use in tree-based data structures and algorithms, enabling efficient queries and optimizations across various domains. One key application is in tree traversals and pattern matching, particularly for processing hierarchical documents like XML. In XML parsing, the document object model (DOM) represents the XML structure as a tree, where LCA computations identify the deepest common ancestor of two elements to resolve structural relationships in queries, such as finding the lowest node containing both target tags for efficient path evaluation in XPath expressions. This approach reduces traversal overhead in large DOM trees, supporting applications like document validation and selective extraction without full tree scans. In compiler optimizations, LCA plays a crucial role in control flow analysis through dominator trees. A dominator tree models the (CFG) of a program, where a dominates another if every path to the latter passes through the former; the immediate dominator of a is its LCA with respect to the in the dominator tree. This structure facilitates optimizations like loop identification, dead code elimination, and by pinpointing control dependencies, as seen in reducible flow graphs where LCA-based algorithms compute in linear time relative to the size. For instance, in global code motion, the LCA of instruction uses in the dominator tree determines safe placement points to minimize redundant computations. Network routing leverages LCA in trees to optimize data distribution in networks. In protocols like for , the LCA of receiver paths in the identifies the branching point (e.g., a router serving multiple downstream hosts), allowing efficient and resource along shared segments without duplicating flows unnecessarily. This is particularly vital in environments, where handovers may alter topology, and LCA recomputation ensures minimal disruption by reusing existing paths from the common ancestor to the . Such techniques enhance in group communications, reducing bandwidth overhead in scenarios like video streaming over . In string algorithms, LCA supports efficient computation of the () via suffix trees. A for multiple strings encodes all suffixes, and the length between two strings equals the depth of the deepest internal ( of relevant leaf suffixes) whose subtree contains leaves from both strings, enabling preprocessing and LCS queries with LCA acceleration. This method underpins applications like plagiarism detection and bioinformatics , where identifying shared substrings avoids exhaustive pairwise comparisons. For dynamic settings, extensions maintain LCA structures over evolving suffix trees to handle insertions while preserving LCS accuracy.

In Other Fields

In phylogenetics, the lowest common ancestor (LCA) is employed to identify the most recent shared progenitor of or taxa within evolutionary , facilitating the reconstruction of biological relationships from genomic data. Tools such as ngsLCA enable efficient computation of LCAs for taxonomic assignments in metagenomic analyses, integrating with databases like NCBI's for accurate of sequences across diverse microbial communities. For instance, in a of primates, the LCA of humans and chimpanzees represents their shared ancestor approximately 6–7 million years ago, aiding in studies of evolutionary divergence. Similarly, PhyloFinder leverages LCA-based similarity measures to query and visualize phylogenetic databases, supporting taxonomic searches that trace common ancestry in large-scale tree repositories. In systems, LCA plays a crucial role in resolving merge conflicts by identifying the common ancestor commit in the (DAG) of history. During a three-way merge in , the system computes the merge base as the LCA of the two branches, allowing comparison of changes from that point to detect and highlight discrepancies for manual resolution. This approach ensures that developers can integrate parallel modifications without losing historical context, as demonstrated in analyses of Git's merge behavior where the LCA commit serves as the for computations. In ontologies and , LCA is utilized in knowledge graphs to quantify between concepts, particularly in hierarchical structures like . The Resnik measure, for example, calculates similarity as the negative log of the of the LCA of two synsets, enabling applications in for tasks such as . In (GO), a representing biological functions, LCA-based methods like those in GOntoSim assess functional similarity between gene products by considering the and descendant overlap at the LCA, supporting AI-driven predictions in bioinformatics. An illustrative example is in , where the LCA of synsets for "" and "" might be a higher-level concept like "" for subsumption reasoning, or closer terms like "" and "" sharing "canine" as their LCA to infer semantic relatedness. In , LCA aids in tracing transmission chains within phylogenetic trees of pathogen outbreaks, particularly for post-2020 COVID-19 models that integrate genomic and data. By identifying the LCA of infected cases' sequences, researchers can pinpoint superspreading events or sources, as seen in fog-computing-enhanced frameworks for that use LCA in aggregation trees to efficiently propagate alerts from shared ancestors in outbreak networks. For , phylogenetic analyses often compute the —equivalent to the LCA in rooted trees—of variant clusters to estimate introduction dates and dispersal patterns, filling gaps in surveillance models.

References

  1. [1]
    [PDF] Lowest Common Ancestors in Trees and Directed Acyclic Graphs1
    We study the problem of finding lowest common ancestors (LCA) in trees and directed acyclic graphs (DAGs). Specifically, we extend the LCA problem to DAGs ...
  2. [2]
    Lowest Common Ancestor - Tarjan's off-line algorithm
    Jun 8, 2022 · The algorithm is named after Robert Tarjan, who discovered it in 1979 and also made many other contributions to the Disjoint Set Union data ...
  3. [3]
    Fast Algorithms for Finding Nearest Common Ancestors - SIAM.org
    Fast Algorithms for Finding Nearest Common Ancestors. Authors: Dov Harel and Robert Endre Tarjan ...
  4. [4]
    Lowest Common Ancestor - Farach-Colton and Bender algorithm
    Apr 15, 2025 · The algorithm which will be described in this article was developed by Farach-Colton and Bender. It is asymptotically optimal.
  5. [5]
    Rooted Tree -- from Wolfram MathWorld
    A rooted tree is a tree in which a special ("labeled") node is singled out. This node is called the "root" or (less commonly) "eve" of the tree.
  6. [6]
    On Finding Lowest Common Ancestors in Trees
    On Finding Lowest Common Ancestors in Trees. Authors: A. V. Aho, J. E. Hopcroft, and J. D. UllmanAuthors Info & Affiliations. https://doi.org/10.1137/0205011.
  7. [7]
    Lowest Common Ancestor of Two Nodes in a Tree - Baeldung
    Jun 29, 2024 · The Lowest Common Ancestor (LCA) of two nodes is the deepest node that is an ancestor of both nodes. An ancestor is any node on the path from ...
  8. [8]
    [PDF] Properties of the Lowest Common Ancestor in a Complete Binary Tree
    Abstract: The paper presents and proves several theorems that disclose kinds of relations between a lowest-common-ancestor (LCA) and its descendant nodes in ...Missing: original | Show results with:original
  9. [9]
    [PDF] The LCA Problem Revisited
    May 16, 2000 · One of the most fundamental algorithmic problems on trees is how to find the Least Common Ancestor. (LCA) of a pair of nodes. The LCA of ...
  10. [10]
    [PDF] Common Ancestor Algorithms in Dags - mediaTUM
    We formally define common ancestors (CAs) and lowest common ancestors (LCAs) of vertex pairs in directed acyclic graphs. Definition 2.7 (Common Ancestor).
  11. [11]
    [PDF] Computing Lowest Common Ancestors in Directed Acyclic Graphs1
    The lowest common ancestors of x and y are the elements of SLCA(x, y). The ... Hopcroft, J. D. Ullman. The Design and Analysis of Computer Algorithms ...
  12. [12]
    Lattice-theoretic properties of MPR-posets in phylogeny
    The poset J(P) of order ideals of the posets P actually forms a lattice. The lattice operations ∨ (join) and ∧ (meet) on order ideals are just ordinary ...
  13. [13]
    [PDF] Appendix: Splay trees and link-cut trees
    Show how to use Lemma 18.0.2 to support in log n time the operation LCA(u, v), which returns the lowest common ancestor of nodes u and.
  14. [14]
    Lowest Common Ancestor in a Binary Search Tree - GeeksforGeeks
    Oct 11, 2025 · Explanation: 12 is the lowest common ancestor (LCA) of nodes 10 and 14, as it is the deepest node that is an ancestor of both.
  15. [15]
    Quantum and approximation algorithms for maximum witnesses of ...
    Apr 29, 2020 · Abstract page for arXiv paper 2004.14064: Quantum and approximation ... lowest common ancestor (LCA) problem in directed acyclic graphs (dags).
  16. [16]
    [PDF] Simplifying and Characterizing DAGs and Phylogenetic Networks ...
    Jan 23, 2025 · We then show that the set of least common ancestors of a set A ⊆ L(G) can be determined in linear time when |A| ∈ O(1) is constant. ...
  17. [17]
    On finding lowest common ancestors in trees - ACM Digital Library
    Aho and J. D. Ullman, The Theory of Parsing, Translation and Compiling ... On Finding Lowest Common Ancestors in Trees. Trees in an n-node forest are ...
  18. [18]
    On Finding Lowest Common Ancestors: Simplification and ...
    Applications include finding lowest common ancestors in trees by a new algorithm that is considerably simpler than the known algorithms for the problem, ...
  19. [19]
    Improved Algorithms for Finding Level Ancestors in Dynamic Trees
    Feb 18, 2002 · S. Alstrup and M. Thorup. Optimal pointer algorithms for finding nearest common ancestors in dynamic trees. In 5th Scan. Work. on Algo. Theo., ...
  20. [20]
    Fully-functional succinct trees - ACM Digital Library
    We propose new succinct representations of ordinal trees, which have been studied extensively. It is known that any n-node static tree can be represented in ...
  21. [21]
    Theoretical and Practical Improvements on the RMQ-Problem, with ...
    We present a direct algorithm for the general RMQ-problem with linear preprocessing time and constant query time, without making use of any dynamic data ...
  22. [22]
    Efficient Identification of Structural Relationships for XML Queries ...
    Oct 1, 2016 · By utilizing document object model DOM, XML document can be viewed as XML DOM tree. ... Effective performance analysis of lowest common ancestor ...
  23. [23]
    Exploit keyword query semantics and structure of data for effective ...
    A node u is a CVLCA if it is a VLCA node and u dominates every node in F, where u dom- ... 3http://www.sigmod.org/record/xml/. 4http://monetdb.cwi.nl/xml/.
  24. [24]
    On finding lowest common ancestors in trees
    ON FINDING LOWEST COMMON ANCESTORS IN TREES by. A. V. Aho. Bell Laboratories. Murray Hill, New Jersey 07974. J. E. Hopcroft*. Cornell University. Ithaca, New ...
  25. [25]
    Global code motion/global value numbering
    We want to find the lowest common ancestor (LCA) in the dominator tree of all an instruction's uses. Find- ing the LCA could take O(n) time for each ...
  26. [26]
    Integrated Service Mobile Internet: RSVP over Mobile IPv4&6
    Router. R3 is the lowest common ancestor. RSVP states in the path from router R3 to the foreign agent in B must be newly estab- lished. RSVP states in ...
  27. [27]
    A Distributed Data Management Scheme for Industrial IoT ...
    It imposes that all data requests and data deliveries are being routed through the lowest common ancestor (LCA) of the routing tree instead of the controller C.
  28. [28]
    [PDF] Faster Algorithms for Longest Common Substring - Hal-Inria
    May 7, 2021 · Keywords and phrases longest common substring, k mismatches, wavelet tree ... answer lowest common ancestor (LCA) queries in O(1) time [14] ...
  29. [29]
    [PDF] Longest Common Substring Made Fully Dynamic - arXiv
    Jul 16, 2018 · A lowest common ancestor data structure can be constructed over the suffix tree ... Longest common substring with approximately k mismatches.
  30. [30]
    Lowest Common Ancestor - Binary Lifting - CP-Algorithms
    Sep 24, 2023 · The desired node w is the lowest ancestor of u and v. In particular if u is an ancestor of v, then u is their lowest common ancestor.