
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
النسخة 8الرقم المعياري الدولي: 978-1285867410
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
النسخة 8الرقم المعياري الدولي: 978-1285867410 تمرين 3
Using a Bubble Sort
int numbers[] = {432, -5, 54, -10, 36, 9, 65, 21, 24};const int NUM_ITEMS = 9;int j, k, temp;int numPasses = 0, numCompares = 0, numSwaps = 0;for(j = 0; j numbers[k+1]){numSwaps++;temp = numbers[k+1];numbers[k+1] = numbers[k];numbers[k] = temp;}}}
Do the variables named numPasses, numCompares, and numSwaps accurately keep track of the number of passes, compares, and swaps made in this bubble sort? Explain your answer.
int numbers[] = {432, -5, 54, -10, 36, 9, 65, 21, 24};const int NUM_ITEMS = 9;int j, k, temp;int numPasses = 0, numCompares = 0, numSwaps = 0;for(j = 0; j numbers[k+1]){numSwaps++;temp = numbers[k+1];numbers[k+1] = numbers[k];numbers[k] = temp;}}}
Do the variables named numPasses, numCompares, and numSwaps accurately keep track of the number of passes, compares, and swaps made in this bubble sort? Explain your answer.
التوضيح
Values of variables:
, the given cod...
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
لماذا لم يعجبك هذا التمرين؟
أخرى 8 أحرف كحد أدنى و 255 حرفاً كحد أقصى
حرف 255