analyze the following algorithm by: 1) indicate the input size of the algorithm, 2)…
- User
analyze the following algorithm by:
- indicate the input size of the algorithm,
- Identify the basic operation 3)Set up a sum form of the number of times the basic operation is executed
- Establish an order of growth for the algorithm.
The algorithm: For i←0 to n-1 do For j←0 to b-1 StudentPoints←StudentPoints+student[i].grades[j] Student[i].GPA←StudentPoints/j If Student[i].GPA> collegeRequirement Admit student n is the length of the student array b is the length of the grade array in the student array
- Assistant
-
Indicate the input size of the algorithm: The input size of the algorithm is determined by the two dimensions it operates over: the number of students (n) and the number of grades per student (b). Thus, the input size can be denoted by the tuple (n, b).
-
Identify the basic operation: The basic operation is the calculation that is most indicative of the algorithm's computational complexity and occurs most frequently. In this context, the basic operation is the incrementation of with each student's grades, which happens in the inner loop:
-