MCPcopy
hub / github.com/TheAlgorithms/JavaScript / lcaBinaryLifting

Function lcaBinaryLifting

Graphs/LCABinaryLifting.js:51–59  ·  view source on GitHub ↗
(root, tree, queries)

Source from the content-addressed store, hash-verified

49}
50
51function lcaBinaryLifting(root, tree, queries) {
52 const graphObject = new LCABinaryLifting(root, tree)
53 const lowestCommonAncestors = []
54 for (const [node1, node2] of queries) {
55 const lca = graphObject.getLCA(node1, node2)
56 lowestCommonAncestors.push(lca)
57 }
58 return lowestCommonAncestors
59}
60
61export default lcaBinaryLifting

Callers 1

Calls 2

getLCAMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected