Number of Comparisions (II)
Computer Science Level 2Find the number of comparisons done in the following algorithm.
1 2 3 4 5 6 7 

Assumptions and Details
 \(n\) is a nonnegative integer.
 Don't count any comparison made by the for loop itself (i.e. whether or not to proceed with another loop).
Can you solve this as well?
Your answer seems reasonable.
Find out if you're right!
Sign up to access problem solutions.
That seems reasonable.
Find out if you're right!
Already have an account? Log in here.