Algorithms done for fun