Mazdak Farrokhzad edited Version 3.tex  over 10 years ago

Commit id: f6a63b926c574ebf134a1588fb926922b71abb67

deletions | additions      

       

2 int thisSum = 0; (1 op)  3 for( int i = 0, j = 0; (2 op)  4 j < a.length; (2 op/turn + 2 extra turn at end of loop)  5 j++ ) { (1 op/turn,compiler  will probably turn it to likely become  ++j) 6 thisSum += a[j]; (2 op/turn)  7 if( thisSum > maxSum ) { (2 op/turn, most complex: worst:  if, ignore else-if ) 8 maxSum = thisSum; (2 op/turn)  9 seqStart = i; (2 op/turn)  10 seqEnd = j; (2 op/turn)