Computers and Technology
Computers and Technology, 06.12.2021 17:10, taylor493

Create a package named lab10 (no spaces, ALL in lowercase) where you will place your lab files. Create a class SortingAlgorithms with the following methods:
mergeSort that will implement the algorithm learned in class (see slides for code and copy it from there)
selectionSort that will implement the algorithm learned in class (see slides for code and copy it from there ).
two fields:
mergeCtr that will count the merge sort steps
selectionCtr that will count the selection sort steps
these fields must be placed strategically to count every iteration of the sorting algorithms.
two more methods:
getMergeCtr that will return the value of mergeCtr
getSelectionCtr that will return the value of selectionCtr
An app SortingApp that will:
Create an array a with the values 22, 18, 12, -4, 58, sort it using mergeSort, and display the number of steps it took to sort it.
Create another array b with the same values as a 22, 18, 12, -4, 58 and sort it using selectionSort and display the number of steps it took to sort it.
Create another array c with the values 22, 18, 12, -4, 58, 7, 31, 42, -5, 8, 101, 45, 21,-9 sort it using mergeSort, and display the number of steps it took to sort it.
Create another array d with the same values as c 22, 18, 12, -4, 58, 7, 31, 42, -5, 8, 101, 45, 21,-9 and sort it using selectionSort and display the number of steps it took to sort it.
Compare the results among the different calls to the sorting methods, the steps it took to sort, and display a message with your conclusions.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:00, fluffy374747
The animal classthis class represents a an animal residing at a zoo. it has a weight (in pounds),height (in inches), a name, and a color. the methods in the class include constructors, getters, and a tostring. you will finish the implementation of these methods. referto the code documentation.1.getters: you will need to implement getter methods. these get a value (froma member variable) in the animal class. you will make a getter method toreturn each variable (weight, height, name, color). reference getname if youare having issues.2.tostring: you will need to finish the tostring method. this returns a stringcontaining information about an animal. the output string should be of theformat: ” (name) , a ( color )â’colored animal . ( weight ) pounds , ( height ) inches .\n”the height and weight are formatted to 1 decimal place. recall from lab 1how to format strings neatly using string. see the reference sectionfor more about string. format.
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, jhonpiper
For her science class, elaine is creating a presentation on weather in the united states. she wants to make the presentation beautiful and interesting by drawing simple cloud or wave shapes. which is the best way for elaine to draw these shapes?
Answers: 1
image
Computers and Technology, 23.06.2019 20:00, boo3972
Match the file formats with the types of multimedia they can store
Answers: 2
image
Computers and Technology, 24.06.2019 06:30, titalili0204
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
Do you know the correct answer?
Create a package named lab10 (no spaces, ALL in lowercase) where you will place your lab files. Cr...

Questions in other subjects:

Konu
Mathematics, 28.01.2020 21:58
Konu
Mathematics, 28.01.2020 21:58