Do the variables named numpasses numcompares and numswaps


USING A BUBBLE SORT In this exercise, you use what you have learned about sorting data using a bubble sort. Study the following C++ code and then answer the questions that follow:

55_5d32cb0b-f9b4-4eaa-8b93-11f84eb928a1.png

1. Does this code perform an ascending sort or a descending sort? How do you know?

2. Exactly how many passes are made over the data in the array? Specify a number.

3. How many comparisons are made? Specify a number.

4. 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.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Do the variables named numpasses numcompares and numswaps
Reference No:- TGS02194071

Expected delivery within 24 Hours