Microsoft Interview Question

Related to trees and graphs.