0

For a assignment I was to write two functions to sort a array. One using selection sort and other using insertion sort. The thing I was stuck on was the part that said, "// insert code to display intermediate permutations". I assuming that wants me to write a code to show the changes that are taking place when sorting. But, I'm not sure if that's what is expected. How do I go about showing "permutations"?

Here is the code I have for both type of sorting.\

```
int listMax(int list[], int begin, int end)
{
for(int i = size - 1; i >= 1; i--)
{
int fMax = list[0];
int maxIndex = 0;
for(int j = 1; j <= ; j++)
{
if(fMax < list[j])
{
fMax = list[j];
maxIndex = j;
}
}
}
}
void swap(int list[], int i, int j);
{
if(maxIndex != i)
{
list[maxIndex] = list[i];
list[i] = fMax;
}
}
void insertSort(int list[], int size);
{
for(int i = 1; i < size; i++)
{
int cElement = list[i];
int k;
for(k = i - 1; k >= 0 && list[k] > cElement; k--)
{
list[k + 1] = list[k];
}
list[k + 1] = cElement;
}
}
void selectSort(int list[], int size)
{
int maxIndex, end = size - 1;
while (end > 0)
{
maxIndex = listMax(list, 0, end);
if( maxIndex != end )
swap(list, end, maxIndex);
// insert code to display intermediate permutations
end --;
}
}
```