clear; clc;

data = randi(1000000, 1, 10000);
data2 = data;

tic
for j = 1 : length(data) - 1
    for i = 1 : length(data) - j
        if data(i) > data(i + 1)
            % swap
            tmp = data(i);
            data(i) = data(i + 1);
            data(i + 1) = tmp;
        end
    end
end
toc

tic
sort(data2);
toc