Does parallelism factor in when deriving the computational complexity of a parallel algorithm?
Suppose I have a perfect binary tree $T$ with leaves numbered $1$ to $n$, and an algorithm $\operatorname{Sum}()$ that computes the sum $1 + 2 + \dotsb + n$ in this way:
$\operatorname{Sum}(T)=$
If $T$ is a leaf node $k$, return $k$. Otherwise,
- $a \leftarrow \operatorname{Sum}(\text{left subtree of }T)$
- $b \leftarrow \operatorname{Sum}(\text{right subtree of }T)$
- Return $a + b$.
The total number of additions performed is $2^0 + 2^1 + 2^2 + \dotsb + n/2$. However, if steps (1) and (2) are performed in parallel, is the computational complexity $O(\log n)$ instead?