Lec2 Question
Lec2 Question
Correctness
Time efficiency
Space efficiency
Optimality
Requires implementation
O(1): Constant
O(n): Linear
O(n²): Quadratic
O(2ⁿ): Exponential
O(n!): Factorial
✅ Asymptotic Notations
Q15: What is the time complexity of a nested loop where both loops run from
1 to n?
A15: O(n2)O(n^2)O(n2)
Q16: What is the time complexity of multiplying two square matrices of order
n?
A16: O(n3)O(n^3)O(n3)
Q10: What is the input size for checking the primality of a number?
A) Number of digits in decimal
B) Number of factors
C) Binary size of n
D) Always fixed
✅ Correct Answer: C