Completed HW7 with binary tree.