problem set 3 for algo