I think I have alg1, although my test didn't work for the indecies; I also adjusted a variable that had i instead of a j