Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Bubble sort is a simple sorting algorithm. It works by repeatedly stepping throu

ID: 3619539 • Letter: B

Question

Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements ”bubble” to the top of the list.

Write a Fortran program that will read a list of 50000 integers from an input
file “input ex6 21.dat” into an array. The format of the records will be 10 integers in a row all with a width of 7. Use the bubble sort algorithm to sort the the integers and write them back out into a file “output ex6 21.dat” that is overwritten each time using the same format that was read in.

• You must use an implied do loop to read the integers from the file. Do not use “IOSTAT” argument so that the program will end if there is an error.

• You must use an implied do loop to write the array back out to the “output.dat” file. The format in the ?le should match 10 integers in a row all with a width of 7.

• You must use a named constant for the number 50000 and use the named
constant in your program in all appropriate places.

• Be carefull not to go out of bounds.

• Create two variables, inTime and outTime. Call CPU TIME before running the sort algorithm, ie CALL CPU TIME(TIME=inTime) and call CPU TIME after
the sort algorithm, ie CALL CPU TIME(TIME=outTime) and display the difference.

Explanation / Answer

can you break your work in small pieces and then post here, in this way it will be easy for us to reply to with proper details.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote