Implementing different algorithms for fun