Methods for Evaluating Algorithm Complexity Time and Space Complexity
Time and Space Complexity Time Complexity: ---------------- - Describes the amount of time an algorithm takes to run as a function of the input size. - Common examples: - O(n): A simple loop that runs n times - O(n^2): A nested loop that runs n^2 times Space Complexity: ----------------- - Describes the amount of memory an algorithm uses as a function of the input size. - Space complexity can also be evaluated using Big O notation. - Example: For an algorithm that creates a list of size n, space complexity is O(n).