subject
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}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 04.07.2019 18:10
What difference(s) did you notice using a pneumatic circuit over hydraulic circuit.explain why the pneumatic piston stumbles when it hits an obstacle.
Answers: 2
question
Engineering, 04.07.2019 18:10
Apump is used to circulate hot water in a home heating system. water enters the well-insulated pump operating at steady state at a rate of 0.42 gal/min. the inlet pressure and temperature are 14.7 lbf/in.2, and 180°f, respectively; at the exit the pressure is 60 lbf/in.2 the pump requires 1/15 hp of power input. water can be modeled as an incompressible substance with constant density of 60.58 lb/ft3 and constant specific heat of 1 btu/lb or. neglecting kinetic and potential energy effects, determine the temperature change, in °r, as the water flows through the pump.
Answers: 1
question
Engineering, 04.07.2019 18:10
Asingle-geared blanking press has a stroke of 200 mm and a rated capacity of 320 kn. a cam driven ram is assumed to be capable of delivering the full press load at constant force during the last 15 percent of a constant-velocity stroke. the camshaft has an average speed of 90 rev/min and is geared to the flywheel shaft at a 6: 1 ratio. the total work done is to include an allowance of 16 percent for friction a) estimate the maximum energy fluctuation b) find the rim weight for an effective diameter of 1.2 m and a coefficient of speed fluctuation of 0.10
Answers: 1
question
Engineering, 04.07.2019 18:20
Describe one experiment in which the glass transition temperature and melting temperature of a totally amorphous thermoplastic material can be determined. show the relevant experimental results in a diagram which should be properly annotated with the two temperatures clearly marked. what is likely to happen to the curve in the diagram if the amorphous polymer is replaced by a thermosetting type?
Answers: 2
You know the right answer?
Create a bubble sort algorithm. this algorithm is capable of taking a list of numbers and placing th...
Questions
question
Mathematics, 08.07.2020 09:01
question
Mathematics, 08.07.2020 09:01
question
Mathematics, 08.07.2020 09:01
question
Mathematics, 08.07.2020 09:01
question
Mathematics, 08.07.2020 09:01
Questions on the website: 13722362