Question: A particular program declares an array Cartypes(20,6). The second element in each of its 20 rows stores a value that represents the engine horsepower (ie,

A particular program declares an array Cartypes(20,6). The second element in each of its 20 rows stores a value that represents the engine horsepower (ie, Cartypes(K,2) is the horsepower for the car type stored in row K). Can the simple bubble sort for one-dimensional arrays be used to sort this array, ascending, by horsepower?

yes, no modifications to the bubble sort routine are needed
yes, but only by making sure that the compare looks at the right elements in the array
yes, by comparing the values in Cartypes(K,2) and Cartypes(K+1,2), and then swapping all elements in row K for those in row K+1
no

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!