CaptionsMaker
.com
Lowest Common Ancestor
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
Problem: Given a binary tree and 2 tree nodes A and B, find the lowest common ancestor of the nodes. Solution: Traverse the tree in bottom up approach. If node ( A or B ) is found, return it to its parent. Parent will check if it was able to get nodes from both of its child.If yes, then Parent is LCA. If no, Parent will return NULL if none of its child returned A or B ELSE will return not NULL node.
YouTube url:
https://www.youtube.com/watch?v=NBcqBddFbZw
Created:
15. 8. 2015 01:31:09