branch sort