slowSort - % function output = slowSort(A) index = 1 x = 1...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 %%PROBLEM 5%% % Write a function named slowSort that takes in a vector, sorts it in % ascending order (smallest to largest), and then outputs it. % % Note: you may *not* use the built-in sort function in MATLAB.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % function output = slowSort(A) index = 1 x = 1 while index <= length(A) output = if A(index) < A(index + 1) & output(index) = A(x) x = x + 1 end index = index + 1 A = output end end...
View Full Document

This note was uploaded on 07/06/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online