Type the arithmetic-series closed form
Type the arithmetic-series closed form
Answer
sum(k for k in range(1, n+1)) == n*(n+1)//2
Σ_{k=1}^n k = n(n+1)/2 = Θ(n²). This is the worst-case comparison count of insertion sort and shows up constantly.
Type the arithmetic-series closed form
Type the arithmetic-series closed form
Answer
sum(k for k in range(1, n+1)) == n*(n+1)//2
Σ_{k=1}^n k = n(n+1)/2 = Θ(n²). This is the worst-case comparison count of insertion sort and shows up constantly.