Meta interview question

Implement a tree. The second question was about moving average