Mazdak Farrokhzad edited Version 3.tex  over 10 years ago

Commit id: bb092cdb203f2b5094c8a4810ca8bd35ec99f488

deletions | additions      

       

\subsubsection{Pedantic analysis}  \begin{quote}  For consistency, all operations count, even read/write.  \begin{lstlisting}  1 int maxSum = 0; (1 op)  2 int thisSum = 0; (1 op) 

4 j < a.length; (1 op/turn + 1 extra at end of loop)  5 j++ ) { (1 op/turn)  6 thisSum += a[j]; (2 op/turn)  7 if( thisSum > maxSum ) { (1 (2  op/turn, else-if is most complex: ) 8 maxSum = thisSum; (1 op/turn)  9 seqStart = i; (1 op/turn)  10 seqEnd = j; (1 op/turn)  11 } else if( thisSum < 0 ) { (1 (2  op/turn) 12 i = j + 1; (2 op/turn  13 thisSum = 0; (1 op/turn)  14 }