Analyzing two different algorithms for solving the same problem