reduction 2
two algorithms