EDIT
More specific:
If the denominators of your example:
iter 1: input size = n (always n) iter 2: input size = n/2 (can change) iter 3: input size = n/5 (can change) iter 4: input size = n/8 (can change) ... iter k: input size = n/10 (can change)
are strictly integers, then this is O (n * log k) .
That's why. For the sequence Xn O (Yn) , there must exist some M, a real number and m, an integer such that Xn <M * | Yn | for all n> m.
Now consider the sequence K = {1, 1/2, 1/3, ... 1 / k}. Also consider the sequence N = {1, 2, 3, 4 ...}.
Now let Yn = N ^ t * K (which is the outer left product of N and K). This Yn sequence is always larger than your sequence, regardless of fi values.
Thus, Xn <1 * | Yn |, where Yn is a harmonic series of times n. As can be seen from the figure, Yn falls into O (n * log k) , therefore, Xn also. Since we could not have bounded Xn, which is closer above, our best limit approximation for Xn is also O (n * log k) .
source share