Algorithms exercises