Posts

Showing posts with the label SnapChat

Finding the common ancestor in the tree - Part 2 [reviewed]

Image
Problem You are given a Binary Tree (not BST) along with two pointers to nodes somewhere in the tree. Your algorithm should returns the pointer to the common parent to given nodes. For example, in the following tree Figure 1. Binary Search Tree example The common ancestor of "d" and "f" is "a".