0

Can anyone help me wiht the prog.

arrange a 1D array in ascending order.

No need for the prog. code just explain me the logic.

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by Lerner
0

There are any number of ways to sort an array. Some of them are called bubble sort, qsort, sort(), merge sort, selection sort, etc. Each has their attractions and detractions. For arrays of relatively small size the bubble sort seems to be very popular with beginning programers because of the "simplicity" of implementation. The basic principle of bubble sort is to compare each element of the array, starting the index 0, with every other element in the array and swapping them if the desired criteria is satisfied.

0

my assingment says use selection sort duno what that is.

0

You can look it up using your favorite search engine. Basically, it means first find the smallest in the array and swap it with the element in the first position, then find the second smallest element and swap it with the element in the second position, and continue in this way until the entire array is sorted.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.