World's most popular travel blog for travel bloggers.

Is it or is it not correct to say that the expected runtime of an algorithm is its runtime on the expected problem size? Why?

, ,
Problem Detail:

Say we have an algorithm that takes time $T$ to process a problem of size $n$.

Is $\langle T(n)\rangle$ = $T(\langle n\rangle)$?

In general, it does not hold that $\DeclareMathOperator{\EE}{\mathbb{E}}\EE[f(X)] = f(\EE[X])$. For example, suppose that $X=0$ with probability $1/2$ and $X=1$ with probability $1/2$, and that $f(x) = x^2$. Then $\EE[f(X)] = 1/2$ whereas $f(\EE[X]) = 1/4$.

Question Source : http://cs.stackexchange.com/questions/64273

3200 people like this