dog algorithms