Build Tree coded