Juanka
- 37
- 0
Anyone familiar with a bubble sort? and if so how to implement it?
Juanka said:Anyone familiar with a bubble sort?
and if so how to implement it?
function y= bubble(x,y)
n = length(x);
for k = 1:n-1
for j = 1:n-k
if(x(j)> x(j+1))
temp = x(j);
x(j) = x(j+1);
x(j+1) = temp;
temp = y(j);
y(j) = y(j+1);
y(j+1) = temp;
end % if
end % for
end % for
y = x;
Juanka said:I am having a problem