merge balanced trees