Asymptotic Analysis & Recurrences

Answer & solution
Official answer: C
1. Method and setup. Count valid index triples rather than estimating every loop as n iterations. For a fixed j, index i can take j values and k can take n−j values. Multiplying those independent choices and summing over j gives an exact count; the assignment D=2 performs no multiplication.
2. Work through the result and its assumptions. For each middle index j there are j choices of i and n−j choices of k. The number of multiplications is sum(j=1..n)j(n−j)=n·n(n+1)/2−n(n+1)(2n+1)/6=(n−1)n(n+1)/6, one-sixth the product of three consecutive integers, C.