Baidu interview question

describle tree algorithm and wirte in python