Various algorithms for Algorithms class implemented in java