func (lca *lcaRange) find(a, b *Block) *Block {
	if a == b {
		return a
	}
	// Find the positions of a and bin the Euler tour.
	p1 := lca.blocks[a.ID].pos
	p2 := lca.blocks[b.ID].pos
	if p1 > p2 {
		p1, p2 = p2, p1
	}

	// The lowest common ancestor is the minimum depth block
	// on the tour from p1 to p2.  We've precomputed minimum
	// depth blocks for powers-of-two subsequences of the tour.
	// Combine the right two precomputed values to get the answer.
	logS := uint(log2(int64(p2 - p1)))
	bid1 := lca.rangeMin[logS][p1]
	bid2 := lca.rangeMin[logS][p2-1<<logS+1]
	if lca.blocks[bid1].depth < lca.blocks[bid2].depth {
		return lca.blocks[bid1].b
	}
	return lca.blocks[bid2].b
}
// find returns the lowest common ancestor of a and b.
find returns the lowest common ancestor of a and b.
// find returns the lowest common ancestor of a and b .
func (lca *lcaRange) find(a, b *Block) *Block {
	if a == b {
		return a
	}
	p1 := lca.blocks[a.ID].pos
	p2 := lca.blocks[b.ID].pos
	if p1 > p2 {
		p1, p2 = p2, p1
	}
	logS := uint(log2(int64(p2 - p1)))
	bid1 := lca.rangeMin[logS][p1]
	bid2 := lca.rangeMin[logS][p2-1<<logS+1]
	if lca.blocks[bid1].depth < lca.blocks[bid2].depth {
		return lca.blocks[bid1].b
	}
	return lca.blocks[bid2].b
}
func ( lca * lcaRange ) find ( a , b * Block ) * Block { if a == b { return a } p1 := lca . blocks [ a . ID ] . pos p2 := lca . blocks [ b . ID ] . pos if p1 > p2 { p1 , p2 = p2 , p1 } logS := uint ( log2 ( int64 ( p2 - p1 ) ) ) bid1 := lca . rangeMin [ logS ] [ p1 ] bid2 := lca . rangeMin [ logS ] [ p2 - 1 << logS + 1 ] if lca . blocks [ bid1 ] . depth < lca . blocks [ bid2 ] . depth { return lca . blocks [ bid1 ] . b } return lca . blocks [ bid2 ] . b }
find returns the lowest common ancestor of a and b.
find returns the lowest common ancestor of a and b .
// Find the positions of a and bin the Euler tour. // The lowest common ancestor is the minimum depth block // on the tour from p1 to p2.  We've precomputed minimum // depth blocks for powers-of-two subsequences of the tour. // Combine the right two precomputed values to get the answer.