1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natka813 [3]
3 years ago
9

Write a void function SelectionSortDescendTrace() that takes an integer array, and sorts the array into descending order. The fu

nction should use nested loops and output the array after each iteration of the outer loop, thus outputting the array N-1 times (where N is the size). Complete main() to read in a list of up to 10 positive integers (ending in -1) and then call the SelectionSortDescendTrace() function.
If the input is:

20 10 30 40 -1
then the output is:

40 10 30 20
40 30 10 20
40 30 20 10
Computers and Technology
1 answer:
salantis [7]3 years ago
8 0

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

void SelectionSortDescendTrace(int numbers[], int numElems) {

int maxInd;

for (int i = 0; i < numElems - 1; ++i) {

maxInd = i;

for (int j = i; j < numElems; ++j) {

if (numbers[j] > numbers[maxInd]) {

maxInd = j;

}

}

int temp = numbers[i];

numbers[i] = numbers[maxInd];

numbers[maxInd] = temp;

for (int j = 0; j < numElems; j++) {

cout << numbers[j] << " ";

}

cout << endl;

}

}

int main() {

int numbers[10];

int numElements = 0;

for (int i = 0; i < 10; i++) {

cin >> numbers[i];

if (numbers[i] == -1)

break;

++numElements;

}

SelectionSortDescendTrace(numbers, numElements);

return 0;

}

You might be interested in
Which programming scenario would most likely involve this array block?<br><br>SOMEONE PLEASE HELPPP​
attashe74 [19]

Answer:

answer is D

Explanation:

as the block returns the number of array members, the most likely scenario is the last one.

7 0
3 years ago
Your friends’ preschool-age daughter Madison has recently learned to spell some simple words. To help encourage this, her parent
Mnenie [13.5K]

Answer:

Check the explanation

Explanation:

Given a collection SS of subsets of a set X, an exact cover of X is a subcollection S∗S∗ of SS that satisfies two conditions:

  • The intersection of any two distinct subsets in S∗S∗ is empty, i.e., the subsets in S∗S∗ are pairwise disjoint. In other words, each element in X. is contained in at most one subset in S∗S∗.
  • The union of the subsets in S∗S∗ is X, i.e., the subsets in S∗S∗ cover X. In other words, each element in XX is contained in at least one subset in S∗S∗.

XX is the collection of letters on the refrigerator.

SS is the collection of words that your daughter knows that are made up of letters in X.

S∗S∗ is a subcollection of words from SS that exactly cover X.

7 0
4 years ago
If you want a user to enter exactly 20 values which loop would be the best to use
miskamm [114]
The answer to this is 'for'
3 0
3 years ago
What is the point of completing a value assessment while searching for a career
juin [17]

Answer:

So you can discover Careers that you might like in a more accurate way.

Explanation:

3 0
4 years ago
A group of users can perform certain operations on a shared workbook. Which option helps them to update and track changes in the
irina1246 [14]

The “Allow changes by more than one user at the same time” option.


In a group of users, it is very important to create a shared workbook so that several people are able to update information and track changes in the workbook at the same time. To do so, one should click on the review tab of the excel sheet and select share workbook. On the editing tab of the share workbook dialog box, select the Allow changes by more than one user at the same time check box. Go ahead and click the advanced tab and select option you would want to use and then click OK

 






4 0
3 years ago
Other questions:
  • Constructors ________. initialize instance variables when overloaded, can have identical argument lists when overloaded, are sel
    11·1 answer
  • "a web server that is​ specially-built to manage and deliver business intelligence is called a​ _________."
    7·1 answer
  • What are some examples of options you can control in the Adjust group to affect an image? (Multiple Choice)
    12·2 answers
  • Encryption has a remarkably long and varied history. Spies have been using it to convey secret messages ever since there were se
    7·1 answer
  • What is good prossesser
    15·2 answers
  • When computing the cost of the basket of goods and services purchased by a typical consumer, which of the following changes from
    11·1 answer
  • Create a program that receives the age of a user and determine whether he/she can vote or not. Assume the voting age to be 20. C
    14·1 answer
  • Does anyone know how to fix this? Everytime i make a new page it only types in the middle of the page. I want to type at the top
    11·1 answer
  • Topic: Graphs.1.) Bob loves foreign languages and wants to plan his courseschedule for the following years. He is interested in
    8·1 answer
  • True or false: If you have a 32-bit CPU architecture, it's recommended to use a 64-bit operating system.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!