> MATLAB Sorting vectors without using sort command?

MATLAB Sorting vectors without using sort command?

Posted at: 2014-12-18 
There are many, many different sorting algorithms. Insertion sort is one of the simplest. You make a new array of the same size as the old array. Then pick the maximum value from the old array, insert it into the next spot in the new array, and erase it from the old array. This is also fairly inefficient.

Quicksort is accepted as the most efficient over a wide range of input array types (in terms of size and sorted-ness). It's algorithm is more complex, but still not difficult to implement on your own. Check out the link below. It shows animations of several common sorting algorithms and links to their pseudocode.

http://www.sorting-algorithms.com/

Or, if you just want to cheat, you can grab code from rosettacode:

http://rosettacode.org/wiki/Sorting_algo...

Most of those are implemented in MATLAB.