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
1. Text that is located between and appears in the browser's
aniked [119]

Answer:

huh?

Explanation:

3 0
3 years ago
Wireless technology is best described as a/an
IgorLugansk [536]

Answer:

mobile computing system

Explanation:

6 0
4 years ago
Read 2 more answers
I need this ASAP!
Elanso [62]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
Develop a Python application that incorporates using appropriate data types and provides program output in a logical manner. You
Rasek [7]

Answer:

#program in Python.

# create a dictionary

car_dic = dict()

# read brand of car

car_dic['brand'] = input("Enter brand : ")

#read model of cal

car_dic['model'] = input("Enter model : ")

#read manufactured year

car_dic['year'] = int(input("Enter manufactured year : "))

#starting odometer

car_dic['start_odometer'] = int(input("Enter the starting odometer reading: "))

#ending odometer

car_dic['end_odometer'] = int(input("Enter the ending odometer reading: "))

#mileage of the car

car_dic['mileage'] = float(input("Enter miles per gallon consumed by the vehicle: "))

#Details of the car

print("Details of the car: ")

for i in car_dic:

   print(i, ": ",car_dic[i])

Explanation:

Create a dictionary "car_dic" to store the Details of the car.Then ask user to enter the details of car such as brand, model, year, start_odometer, end_odometer and mileage.Then print all the details of the car.

Output:

Enter brand : Audi

Enter model : A6

Enter manufactured year : 2019

Enter the starting odometer reading: 100

Enter the ending odometer reading: 200

Enter miles per gallon consumed by the vehicle: 12

Details of the car:

mileage :  12.0

end_odometer :  200

year :  2019

model :  A6

start_odometer :  100

brand :  Audi

4 0
3 years ago
How to learning algothrim bett
Stells [14]
The GCSE Computing MOOC (created with Cambridge University Press and Raspberry Pi) can be used either as a course or a flexible teaching resource,
8 0
4 years ago
Other questions:
  • Write a program that determines the price of a movie ticket (similar to the one in the chapter). The program asks for the custom
    9·1 answer
  • Video-sharing sites allow videos to be uploaded in which file format? A. .avi B. .svg C. .tiff D. .xls
    5·1 answer
  • Assume you're running a query on your orders in the past year. You want to see how many orders were placed after May. What type
    5·1 answer
  • Which of the following types does the Java programming language support?
    9·2 answers
  • Which os the following is NOT true about the proof of work concept?
    8·1 answer
  • Which of the following is not System Software?
    5·1 answer
  • What triggers a LinkedIn account ban?
    6·1 answer
  • GIVING 50 POINTS!
    6·2 answers
  • Elan inserted shapes into a slide in his presentation. What is the quickest way to format those shapes?
    8·1 answer
  • You are an administrator of a growing network. You notice the network you have created is broadcasting, but you cannot ping syst
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!