subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Does anybody know how to hack into a google account? i had important information on it and it is gone now and i need getting it back.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
5.a fishing rod is formed from a composite material of 0.5 kg of glass fibers embedded in a matrix of 0.5 kg of epoxy resin. the glass fibers are assumed to be long, continuous and unidirectional. to achieve a greater stiffness it is proposed to use a different composite that is comprised of long continuous carbon fibers that will be embedded in a matrix of 0.5 kg of epoxy resin. if the modulus of elasticity of the carbon fiber composite is 10% greater than the elastic modulus of the glass fiber composite, estimate the mass of carbon fibers that will be used to make the carbon fiber composite. assume the applied tensile stress is parallel to the direction of the long axis of the fibers. the epoxy resin, glass fiber, and carbon fiber have an elastic modulus of 5, 86, and 350 gpa respectively and a density of 1100, 2500, and 1800 respectively.
Answers: 3
You know the right answer?
Create a package named lab10 (no spaces, ALL in lowercase) where you will place your lab files. Cr...
Questions
question
Mathematics, 17.08.2020 15:01
question
English, 17.08.2020 15:01
question
Health, 17.08.2020 15:01
question
Mathematics, 17.08.2020 15:01
question
Mathematics, 17.08.2020 15:01
question
Mathematics, 17.08.2020 15:01
question
Engineering, 17.08.2020 15:01
question
Mathematics, 17.08.2020 16:01
Questions on the website: 13722367