Hi, I'm trying to sort an array of integers. I'm not sure how to sort numbers from lowest to highest. Any ideas?
Thanks- Bunko
Hi, I'm trying to sort an array of integers. I'm not sure how to sort numbers from lowest to highest. Any ideas?
Thanks- Bunko
What have you tried? Where are you stuck?
Mainframe assembler programmer by trade. C coder when I can.
What kind of sort? Bubble sort, cocktail sort, comb sort, gnome sort, selection sort, insertion sort, shell sort, binary tree sort , library sort, merge sort, heap sort, smoth sort, quick sort ?
http://en.wikipedia.org/wiki/Sorting_algorithm
It's a small integer array of ten elements. I'm not sure which sorting algorithm would be the most efficient for such a small array. All I need to do is take those ten numbers and sort them from lowest to highest. Pathetically to say, I'm lost.
Thanks - Bunko
Show your code that is a basic c program shell, with an initialized array with 10 elements.
Mainframe assembler programmer by trade. C coder when I can.
for such a small array I would recommend bubble sort, its the easiest to impliment. Its not usually the fastest but with so few numbers to sort I doubt it will make any difference unless the instructor specifically told you to find the fastest method.
It's take a few more than 10 values to get a picture of what is the fastest. Bubble sort is a good option.
Mainframe assembler programmer by trade. C coder when I can.
I have nothing else to add but this...
http://www.sorting-algorithms.com/