For the bubble sort algorithm listed below, I don't understand at which step does a key comparison occurs and at which step an item assignment occurs. I do understand how the algorithm works though. In other word I don't understand what you call as key comparison and what you call as item assignment.
Please help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
void bubbleSort(int list[], int length)
{
int index;
int temp;
int iteration;
for (iteration=1; iteration<length; iteration++)
{
for (index=0; index<length-iteration; index++)
if (list[index] > list[index+1])
{
temp = list[index];
list[index] = list[index+1];
list[index+1] = temp;
}
}
}