toy algorithm complete