×
Home Discussions Write at Opengenus IQ
×
  • Track your progress
  • RANDOM
  • Join our Internship 🎓
  • 100+ Graph Algorithms
  • 100+ DP Problems
  • 50+ Linked List Problems
  • 50+ Array Problems
  • One Liner
  • 50+ Binary Tree problems
  • #7daysOfCode
  • Linux 💽
  • 🔊 Data Structures
  • Graph Algorithms
  • Dynamic Programming 💑
  • Home

kth ancestor

A collection of 1 post

Algorithms

Binary Lifting with k-th ancestor and lowest common ancestor (LCA)

Binary Lifting is a technique used to find the k-th ancestor of any node in a tree in O(log N). This also leads to a faster algorithm in finding the lowest common ancestor (LCA) between two nodes in a tree. The technique requires preprocessing the tree in O(N log N) using dynamic programming.

Arshad G
OpenGenus IQ © 2022 All rights reserved â„¢ [email: team@opengenus.org]
Top Posts LinkedIn Twitter