build perfect binary tree python