Big O notation describes how an algorithm's runtime or memory usage grows relative to its input size n.
Count extra memory used relative to input size. In-place algorithms use O(1) extra space; recursion and memoization use more.
Answer all 3 questions correctly to unlock Submit.
1What is the time complexity of binary search on a sorted array?
2Which case is usually reported when asked for Big O complexity?
3An algorithm uses one extra hash map of size n. What is its space complexity?
Big O notation describes how an algorithm's runtime or memory usage grows relative to its input size n.
Count extra memory used relative to input size. In-place algorithms use O(1) extra space; recursion and memoization use more.
Answer all 3 questions correctly to unlock Submit.
1What is the time complexity of binary search on a sorted array?
2Which case is usually reported when asked for Big O complexity?
3An algorithm uses one extra hash map of size n. What is its space complexity?