algorithms final exam 1246189