Basic algos for fun