evaluated time complexity for problems 1-3