Numberofcomparison and nunber of item movements
<p>Im using c++ and is using insertion sort</p>

<p>Where in the insertion sort algoithm should we put a counter to monitor number of item movements and number of item comparison. I have included my setup below</p>

<pre><code>void InsertionSort::insertion_sort()
{
    int key,i,count = 0;
for(int j=1;j&lt;10;j++)
 {
    key=Arr1[j];
    i=j-1;
    while(Arr1[i]&gt;key &amp;&amp; i&gt;=0)
    {
     Arr1[i+1]=Arr1[i];
     i--;
     numberOfItemMovements++;
    }
    Arr1[i+1]=key;
}
}
}
</code></pre>

<p>as you can see, i cant seem to figure out where comparison counter should be put, although the item movement counter is good and work as expected. thanks</p>
