結果 : explain time complexity and space complexity of an algorithm with example