% Compare InsertSort and MergeSort
clc; clear all
disp(' n Insert/Merge time')

for k= 10:15
n= 2^k;
x= rand(1,n);

% Time InsertSort
tic
y= insertSortInplace(x);
ti= toc;

% Time MergeSort
tic
z= mergeSort(x);
tm= toc;

fprintf('%6d %20.4f\n', n, ti/tm)
end

% Remember that the analytical values of the sorting effort (N^2 and
% N*log(N)) are meaningful for large N only.

% Note also that the mergeSort implementation requires many function calls
% and the creation of many vectors, which adds to the overhead cost (time).