Build binary tree