Label nodes of a binary tree with nearest right-hand neighbor
Given a structure like the following:
O
/ \
O O
/ / \
O O O
/ / \
O O O
/ \
O O
The program will label the tree with the nearest right-hand neighbor as follows:
O-->null
/ \
O-->O-->null
/ / \
O-->O-->O-->null
/ / \
O------>O-->O-->null
/ \
O-->O-->null
Copyright (c) 2015 Claudio Procida