Explore BrainMass
Share

Explore BrainMass

    Write a JAVA program that implements the bubble-sort algorithm.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a sort method in Java that uses the bubble-sort algorithm. The bubble-sort algorithm makes several passes through the array. On each pass, successive neighboring pairs are compared. If a pair is in decreasing order, its values are swapped; otherwise, the values remain unchanged. The technique is called a bubble sort or sinking sort because the smaller values gradually bubble their way to the top and the larger values sink to the bottom. Use 6.0, 4.4, 1.9, 2.9, 3.4, 2.9, 3.5 to test the method.

    © BrainMass Inc. brainmass.com October 10, 2019, 1:13 am ad1c9bdddf
    https://brainmass.com/computer-science/sorting/java-program-implements-bubble-sort-algorithm-326270

    Solution Summary

    The expert writes a java program that implements the bubble-sort algorithm.

    $2.19