Number of Comparisons (I)

How may comparisons are done in the following algorithm?

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    // Start here

    a := 0
    for i := 1 to n
        for j := i to 1
            if j mod i := 0
                a := a+1
            j := j-1
        i := i+1
    return a

    // Stop here 

This problem is a part of the set: Efficient Algorithms.
×

Problem Loading...

Note Loading...

Set Loading...