| | | | | |

Algorithm Complexity - Loops in Sequence

    for (i = 0; i < n; ++i)
    {
      // 3 atomics in loop body
    }
    for (i = 0; i < n; ++i)
    {
      // 5 atomics in loop body
    }
    
  • Complexity = Θ(3n + 5n) = Θ(n)

| | Top of Page | 3. Introduction to Algorithm Analysis - 19 of 23