function v=quicksort(v)
if length(v) > 1
  % partitionering:
  left = [];
  right = [];
  pivot = v(1);
  for element = v(2:end)
    if element <= pivot
      left = [left element];
    elseif element > pivot
      right = [right element];
    end % if
  end % loop
  
  left = quicksort(left);
  right = quicksort(right);
  
  v = [left pivot right];
end % if
end % quicksort
