Salesforce Interview Question

Sort and Balance a tree