Sorting an array in C?
In C, you can use the built in qsort command: see: http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/ To answer the second part of your question: an optimal (comparison based) sorting algorithm is one that runs with O(n log(n)) comparisons. There are several that have this property (including quick sort, merge sort, heap sort, etc.), but which one to use depends on your use … Read more