Example: Sorting
Plot data: each yields a quadratic
As we’d expect, the differences are in the constants.
Thus, the sort algorithm itself is O(n2).
Array size PC Workstation
n (msec) (msec)
125 12.5 2.8
250 49.3 11.0
500 195.8 43.4
1000 780.3 172.9
2000 3114.9 690.5
f1(n)=.0008n2 + .0031n + .001
f2(n)=.0002n2 + .0004n + .100
Previous slide
Next slide
Back to first slide
View graphic version