expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
Exercise 8
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;}}}
Does this code perform an ascending sort or a descending sort? How do you know?
Explanation
Verified
like image
like image

Code operation:
The given code performs...

close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon