How do you count number of operations in java code , i'm not sure but can someone verify my work
<pre><code>Sum &lt;- 0  // 1 Operation 
for i &lt;- 1 to n do // 2n operations
 for j &lt;-1 to n do // 2(n-1) operations
  k &lt;-1 // 1 operation
while k &lt; n do // n-1 operations
k &lt;- k *c // 2 operations 
sum &lt;- sum +1  // 2 operations 
</code></pre>

<p>In total the number of operations in the code are :</p>

<p>1+2n+2(n-1)+1+(n-1)+2+2 == 5n+3 total # of operations ,</p>

<p>is this how you calculate it , because i understand the concept of each stmt has 3 portions to it ( Comparison, Assignment, Incrementation )</p>

<p>please feel free to correct me is my observations are incorrect </p>
