Engineering
Engineering, 18.11.2019 22:31, jjoyner

Create a bubble sort algorithm. this algorithm is capable of taking a list of numbers and placing them in order, however it is also known as one of the least efficient means of doing so. functionally, a bubble sort will proceed from left to right through an array, comparing pairs on its way. if the first half of the pair it's looking at is larger than the second half of the pair, it will swap them, then continue to the next pair. it will then repeat this process several times over until the list is fully sorted. view the example below: you'll notice the underlined numbers as we go. once the bubble sort visits the last sorted element in an array, it doesn't have to bother with that element anymore, because it's already where it will be in the final sorted array. this can be accomplished in a simple code by keeping track of where the final sorted variable is located with just a simple integer. for this assignment, you'll need to not only sort the given input (and display it in its final sorted form) but you'll also need to keep track of how many comparisons, and reassignments happen. so comparing two numbers will be counted as a single action. swapping the location of two variables will meanwhile be considered three actions, one to store a variable to be swapped in a temporary storage location, another to swap the first of the variables to the second location, and a third to move the variable from the temporary storage location back to where it's going to go. to summarize, comparing two objects in the array will count as one action, and swapping two objects in the array will count as three actions. your results should not only display the sorted version of the array, but also a count of the total number of actions that took place while sorting. sort the following two lists.{1,2,3,4,5,6,7,8,9,10}{10,9,8 ,7,6,5,4,3,2,1}

answer
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, soreese02
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
image
Engineering, 04.07.2019 18:10, aliopqwas
Condition monitoring is a major component of. (clo4) a)- predictive maintenance. b)-preventive maintenance c)-proactive maintenance d)-reactive maintenance.
Answers: 1
image
Engineering, 04.07.2019 18:20, samueltaye
Modern high speed trains do not have perpendicular expansion gaps where rails are joined end-to-end any more they are mostly welded together but what might happen if there was a spell of particularly hot weather that causes inspection of the tracks?
Answers: 1
image
Engineering, 04.07.2019 19:20, rosemary909
In the winter, in order to keep the classroom steadily at 68 f before 10 pm, heating with an average rate of 42,000 btu/hr is provided. assume the outdoor temperature maintains at 32°f, determine the electrical power (kw) required to (a) operate a reversible heat pump (b) operate a real heat pump with a cop (7) of 4.5 and (c) operate an electrical-resistance heater.
Answers: 3
Do you know the correct answer?
Create a bubble sort algorithm. this algorithm is capable of taking a list of numbers and placing th...

Questions in other subjects:

Konu
Biology, 01.04.2020 22:23
Konu
Mathematics, 01.04.2020 22:23