function [] = exercise_1_2_2() % % Written by: % -- % John L. Weatherwax 2007-07-11 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; % the range of n: % n=1:60; % the insertion sort running time: % is = 8*(n.^2); % the merge sort running time: % ms = 64*n.*log(n); figure; his = plot( n, is, '-rx' ); hold on; hms = plot( n, ms, '-bo' ); grid on; legend( [ his hms ], 'insersion sort', 'merge sort' ); xlabel( 'n (steps)' ); ylabel( 'running time' ); % n=26:27; 8*(n.^2) - 64*n.*log(n)