algorithm complete