CIS 3223 Lab02 – Merge Sort Algorithm
DUE: (before the next lab, 10:30am Friday, Feb 8, 2008)
TASKS
function sorted_array
= merge_sort(original_array)
that takes original_array as input and produces sorted_array as output. Submit the Matlab
code you wrote.
N = 100;
original_array = rand(N,1);
tic
sorted_array = merge_sort(original_array);
elapsed_time = toc
N = 100;
original_array = rand(N,1);
sorted_array = merge_sort(original_array);
tic
sorted_array = merge_sort(sorted_array);
elapsed_time = toc
Submit the tables summarizing the elapsed times in both
types of experiments. Discuss
the results and explain how the elapsed time changes as a function of N (e.g.,
linearly, quadratically, exponentially).
Compare the results with
those of Insertion Sort obtained in Lab 1.