Purchase Solution

Creating a sorting array

Not what you're looking for?

This is what I want to achieve. I have an array of positive integers which I wish to sort according to the sequence represented by the integer number line. The bubble sort operates as follows:

1. Find the two adjacent elements, X and Y, in the array such that X > Y and swap X and Y, then sort the resulting array.

2. If there is no adjacent pair of elements, X and Y, in the array such that X > Y, the list is sorted.

Note that the purpose of swapping two elements X and Y that occur out of order is so that after the swap, the new list is closer to a sorted list. After a sufficient amount of swapping, we should end up with all the elements in order. For example given the array:

{1 2 5 4 7 3 6 8 10 9}

we would commence by finding the elements 5 and 4 and swap them to get:

{1 2 4 5 7 3 6 8 10 9}

We would then continue as follows:

{1 2 4 5 7 3 6 8 10 9}
{1 2 4 5 3 7 6 8 10 9}
{1 2 4 3 5 7 6 8 10 9}
{1 2 3 4 5 7 6 8 10 9}
{1 2 3 4 5 6 7 8 10 9}
{1 2 3 4 5 6 7 8 9 10}

Design and implement a Java program which sorts a 10 element integer array using the bubble sort process. The elements of the array to be sorted should be supplied by the user (assume the user will not input duplicates).

Create a GUI front end for your bubble sort program.

Solution Summary

The expert creates a sorting array. Adjacent pairs of elements in an array are determined. The solution is provided in a Java file.

Solution Preview

Dear Student,
Find the solution attached. Study the code carefully. It accepts user ...

Solution provided by:
Education
• BSc (Hons), University of Colombo - Sri Lanka
• MEngSc, University of Melbourne
• Certificate IV in Training & Assessment , Australian Business Council
Recent Feedback
• "Thank you!"
• "Thank you."
• "Thanks a lot for you help and support"
• "Sorry about the late payment but the assignment was sufficient and appreciated. Good work"
• "Great description! Thank you for your quick response."

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.