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

Function binaryLifting

Graphs/BinaryLifting.js:72–80  ·  view source on GitHub ↗
(root, tree, queries)

Source from the content-addressed store, hash-verified

70}
71
72function binaryLifting(root, tree, queries) {
73 const graphObject = new BinaryLifting(root, tree)
74 const ancestors = []
75 for (const [node, k] of queries) {
76 const ancestor = graphObject.kthAncestor(node, k)
77 ancestors.push(ancestor)
78 }
79 return ancestors
80}
81
82export default binaryLifting

Callers 1

Calls 2

kthAncestorMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected