{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

slowSort - %is an empty vector else[num ind = min(vec%finds...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function out = slowSort(vec) %Given a 1xN array of scalars (a vector), write a function slowSort %that recursively sorts the vector in ascending order and outputs this %sorted vector. %usage: out = slowSort(vec) if isempty(vec) %initial condition to check and see if the original vector and all of %the recursive vectors are empty out = []; %terminating condition; sets the output equal to an empty vector if vec
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %is an empty vector else [num ind] = min(vec); %finds the number and index of the first minimum value, to account for %repeated numbers vec(ind) = ; %removes the first appearance of the minimum value out = [num slowSort(vec)]; %concatenates the minimum with the recursive function to continue to %keep increasing the order end end...
View Full Document

{[ snackBarMessage ]}