Please consider the following triple-nested loop:for (int i = 1; i <= n; ++i)    for (int j = i; j <= n; ++j)        for (int k = j; k <= n; ++k)            // statementThe statement here is executed exactly $n(n+1)(n+2)\over6$ times. Could someone please explain how this formula was obtained? Thank you.
Time complexity of a triple-nested loop
algorithms;time complexity;algorithm analysis