%selectionSort(vector<number>) -> vector<number>
%Description:
%  Takes an unsorted vector of numbers and returns the sorted
%  set of the same numbers
%Example:
%  selectionSort([15 6 8 10 2 21]) -> [2 6 8 10 15 21]
function out = selectionSort(values)

for index = [1:length(values)]
  %find the minimum
  %fprintf('values from %f to %f', index, length(values));
  [minValue minIndex] = findMin(index, values);
  %swap the min with the first
  values(minIndex) = values(index);
  out(index) = minValue;
  %disp(out);
%repeat
end
