---
# System prepended metadata

title: 'Lab: Complexity Analyses (#24)'

---

# Lab: Complexity Analyses (#24)
## Problem: Iterative Counting
### a.
compute1: sum = Math.max(0, arr[i] + sum)
compute2: sum += arr[j]
compute3: sum += arr[k]

### b.
compute 1:
$\sum_{0}^{arr.length - 1}1$



comupute 2: 
$\sum_{i = 0}^{arr.length-1}(\sum_{j = i}^{arr.length-1}1)$

compute 3: 
$\sum_{i = 0}^{arr.length-1}(\sum_{j = i}^{arr.length-1}(\sum_{k = i}^{j}1))$

### c.

compute 1: 
$(arr.length - 1)\times 1$

compute 2: 
$(arr.length - 1)\times (\sum_{j = i - i}^{arr.length-1 - i}1)$
= $(arr.length - 1)\times (\sum_{j = 0}^{arr.length- 1 - i}1)$
= $(arr.length - 1)\times (arr.length- 1 - i) \times 1$
