I am working on a function called vecSort that is supposed to arrange a vector from the smallest element to the largest using recursion. I cannot use the 'sort' function or any function similar to it. I have to use the min and/or max functions. This is what I have so far:
function vectorSort(vec)L=length(vec);if L<1 vec=[];elseif L==1 vec=vec;else i>1;
I have set the terminating condition but I cannot figure out how to get function to call on itself to arrange the vector from the minimum element to the largest element.
Best Answer