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
zhenek [66]
3 years ago
10

Write a method, public static void selectSort(ArrayList list), which implements a selection sort on the ArrayList of Integer obj

ects list. For example, if the parameter list would be printed as [3, 7, 2, 9, 1, 7] before a call to selectSort, it would be printed as [1, 2, 3, 7, 7, 9] after the method call.
Computers and Technology
1 answer:
Pachacha [2.7K]3 years ago
8 0

Answer:

Explanation:

The following code is written in Java and like asked in the question, it is a function that takes in an ArrayList of Integers as a parameter and uses selection sort to sort the array.

public static void selectSort(ArrayList<Integer> list) {

                       for (int i = 0; i < list.size() - 1; i++)

                       {

                               int index = i;

                               for (int j = i + 1; j < list.size(); j++){

                                       if (list.get(j) < list.get(index)){

                                               index = j;

                                       }

                               }

                               int smallerNumber = list.get(index);

                               list.set(index, list.get(i));

                               list.set(i, smallerNumber);

                       }

               }

You might be interested in
Which type of account typically has very high liquidity, low or no interest, and low minimum balance?
solniwko [45]
A basic savings account is a type of account that typically has a very high liquidity, low or no interest, and low minimum balance. Although it only has low interest rates, you can easily check your balances or the amount you have. Hope this helps! (sorry I'm so late!) 
5 0
3 years ago
Read 2 more answers
Which country has the best land soldier​
irina [24]
China India United Kingdom France Germany turkey South Korea
6 0
3 years ago
Read 2 more answers
Shelby likes to play video games on an old Atari video game system. No matter how old the cartridge, when she inserts it into th
Nady [450]

Answer:

ROM (Acronym of Read-only memory. (video games))

Explanation:

7 0
3 years ago
Read 2 more answers
Am nevoie de un referat pe tema ,,Asezarea in Pagina '' la informatica
In-s [12.5K]

Answer:

Explanation:

Microsoft Word este un procesor de text modern,Microsoft Excel,

Microsoft PowerPoint si Microsoft Access.

Programul va poate ajuta sa realizati documente,

5 0
3 years ago
01110111 01101000 01100001 01110100 00100000 01101001 01110011 00100000 00110001 00101011 00110001
Lera25 [3.4K]
Same lol thesis so me right now
7 0
4 years ago
Other questions:
  • Text, numbers,graphics, sounds entered into a computer's memory during input operations are referred to as
    11·1 answer
  • To easily add an organizational chart to a document, users should select _____. SmartArt Text Boxes Shapes Clip Art
    8·2 answers
  • Technology can help governments handle economic emergencies, such as the reliance on automation. Crop and resource shortages. Th
    15·2 answers
  • A certain computer can be equipped with 268,435,456 bytes of memory. Why would a manufacturer choose such a peculiar number inst
    12·1 answer
  • Two ways in which the media does not reflect the society you live in.
    9·1 answer
  • It is an electronic device that capable of accessing accepting processing product and storing data​
    13·1 answer
  • A constraint that is concerned with cost and must be considered when designing is Group of answer choices Economic Aesthetic Pol
    6·1 answer
  • _____ drives are storage drives that contain both solid-state storage and hard disks in an attempt to gain the speed and power o
    13·1 answer
  • Why big data influnce the rise of AI<br><br>​
    8·2 answers
  • assuming the default gateway is connected to the internet, what type of internet access would this server have?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!