April 22, 2016
Find the lowest common ancestor of two nodes in a Binary Tree. The tree does not have a parent pointer. Your algorithm should run in linear time, without any extra space.
Bottom-up approach.
http://www.geeksforgeeks.org/lowest-common-ancestor-binary-tree-set-1/
HackerRank problem:
https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor
https://www.topcoder.com/community/data-science/data-science-tutorials/range-minimum-query-and-lowest-common-ancestor/
Review blog:
http://juliachencoding.blogspot.ca/2015/07/leetcode-lowest-common-ancestor-in.html
No comments:
Post a Comment