Professional Documents
Culture Documents
a: array of integers; num:=100; n:=50; max:=1 million; while (i<=max) do bublesorttotaltime := 0; bubblemax := 0; : for j:=1 to num loop a:=random array of integers of length i; starttime := system.time(); bubblesort(a); endtime := system.time(); totaltime := endtime-starttime; bubblesorttotaltime += totaltime; if totaltime > bubblemax then bubblemax := totaltime; insertionsort(a); : quicksort(a); end loop; avgbubblesorttime := bubblesorttotaltime/num; i:=i*2; end loop;