Baidu Interview Question

describle tree algorithm and wirte in python