function [a] = BubbleSort(a) n=numel(a); for j=1:n for i=1:n-j if a(i)>a(i+1) t=a(i); a(i)=a(i+1); a(i+1)=t; end end end end