Various algorithms and their implementations