slowSort - out = ; %terminating condition; sets the output...

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
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: out = ; %terminating condition; sets the output equal to an empty vector if vec %is an empty vector else [num ind] = min(vec); out = [min(vec) slowSort(vec(min(vec)~=vec))]; %concatenates the minimum with the recursive function to continue to %keep increasing the order end end...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online