Intro to Algorithm Analysis with some simple Loop Analysis

  • Consider the following program fragment that process an input array of n elements:

       double sum = 0
    
       for ( int i = 0; i < n; i++ )
           sum += array[i];  

  • How many times is the loop body executed ?

    • ???