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
netineya [11]
3 years ago
11

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

ction 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:
Computers and Technology
1 answer:
vampirchik [111]3 years ago
7 0

Answer:

Explanation:

The following program is written in Java. The main method asks the user to enter 10 different integer values. These values are saved to an integer array and passed to the SelectionSortDescendTrace() method. This method sorts the array in descending order while printing the entire array after every outer loop cycle. The program was tested and the output can be seen in the attached image below.

import java.util.*;

class Brainly {

   // Main Method

   public static void main(String[] args)

   {

       Scanner in = new Scanner(System.in);

       int[] myArr = new int[10];

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

           System.out.print("Enter an integer: ");

           myArr[i] = in.nextInt();

           System.out.print('\n');

       }

       SelectionSortDescendTrace(myArr);

   }

   public static void SelectionSortDescendTrace(int[] myArr) {

       int temp;

       for (int i = 0; i < myArr.length; i++)

       {

           for (int j = 0; j <myArr.length; j++)

           {

               if (j != myArr.length - 1)

               {

                   if (myArr[j] < myArr[j + 1])

                   {

                       temp = myArr[j];

                       myArr[j] = myArr[j + 1];

                       myArr[j + 1] = temp;

                   }

               }

           }

           System.out.println(Arrays.toString(myArr));

       }

   }

}

You might be interested in
Function of pons for class 7​
Dmitriy789 [7]
The pons is the primary structure of the brain stem present between the midbrain and medulla oblongata. It serves as a relay signals between the lower cerebellum, spinal cord, the midbrain, cerebrum and other higher parts of the brain. The main functions of the pons include: Controlling sleep cycles.
6 0
3 years ago
Assume that we have an application with a total of 500,000 instructions where 20% of them are the load/store instructions with a
balu736 [363]

Answer:

1.25

Explanation:

#instructions = 5*10^{5}  

Average CPI (old) = 0.2*6 + 0.8*1 = 1.2+0.8 = 2.0

Average CPI (new) = 0.2*12 + 0.8*1 = 2.4 + 0.8 = 3.2

Assuming Clock Rate = x

Speedup = Execution Time (old) / Execution time (new)  = (2.0*5*10^{5} /x) / (3.2*5*10^{5} /2x)  = 4/3.2 = 1.25

5 0
3 years ago
Why RAM is necessary in a computer​
Alexxx [7]

Answer:

The more RAM your CPU has access to, the easier its job becomes, which enables a faster computer. If you do not have a sufficient amount of RAM than your CPU has to work much, much harder to transfer data, which severally damages the computer's performance. Random access memory also helps your system support software.

Explanation:

4 0
3 years ago
Server farms such as Google and Yahoo! provide enough compute capacity for the highest request rate of the day. Imagine that mos
EleoNora [17]

Answer:

a) Power saving = 26.7%

b) power saving = 48%

c) Power saving = 61%

d) Power saving = 25.3%

Explanation:

3 0
4 years ago
Which type of app is the best choice when it is critical to be able to use the device's features but performance is not critical
Alchen [17]

Answer:

The answer is not native. I just got in wrong.

Explanation:

Edge 2021

4 0
3 years ago
Read 2 more answers
Other questions:
  • Hard drive storage is considered to be solid state. true or false
    8·1 answer
  • Choosing firm goals for your business
    7·2 answers
  • Each warning label must contain this element and its purpose is to provide a visual alert to users to the chemical hazards to wh
    14·2 answers
  • This one too its from computer engineering
    6·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·2 answers
  • This function causes a program to terminate, regardless of which function or control mechanism is executing.
    12·1 answer
  • Write a method that takes in a String and returns a new
    15·1 answer
  • Which one of these is NOT an indicator that an email is spam?
    5·1 answer
  • How do you delete your brainly account
    6·1 answer
  • How can touch typing increase productivity of a business?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!