Analysis of Permutation Problem

void indexsort( vector<int> & data)
{
   int i, n = data.size();

   for (i = 0; i < n; i++)
   {
      while(data[i]-1 != i)
         swap(data, i, data[i]-1);
   }
}

Here are the steps for potential function analysis:


next up previous
Next: Punch Line Up: POTENTIAL FUNCTION ANALYSIS Previous: Using the Inequality