1. Worst-case analysis counts the maximum required number of operations for a function. If the exact count of the number of operations cannot be determined, the number of operations may be estimated, provided that the estimate is guaranteed to be higher than the actual number of operations.
2. This is a nested loop in which the number of times the inner loop executes is one more than the value of the outer loop index. The inner loop statements executen+ (n– 1) + ... + 2 + 1 times. This sum isn(n+ 1)/2 and givesO(n2).
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here