Update alg1.h

Edits and fixes after finishing alg3