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, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
question
Computers and Technology, 24.06.2019 11:40
100 pts. first person gets brainliest
Answers: 2
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
question
Computers and Technology, 24.06.2019 16:30
The database design steps are listed below in the incorrect order. choose the correct order number next to each step. determine the information to be stored in the database. determine the fields needed to record the data determine if there will be any repetition of data entered, and separate the fields into tables to normalize the data. create relationships to connect the tables.
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, 27.05.2021 23:40
question
Mathematics, 27.05.2021 23:40
question
Mathematics, 27.05.2021 23:40
question
Social Studies, 27.05.2021 23:40
question
Mathematics, 27.05.2021 23:40
question
Biology, 27.05.2021 23:40
question
Mathematics, 27.05.2021 23:40
Questions on the website: 13722367