Rate of Growth of Functions | 17
AlgorithmsThe Math of
regression analysis. The “fitness” of a trend line to the actual data is based on a
value between 0 and 1, known as the R^2 value. Values near 1 indicate a high
fitness. For example, if R^2 = 0.9948, there is only a 0.52% chance that the fitness
of the trend line is due to random variations in the data.
SORT-4 is clearly the worst performing of these sort algorithms. Given the 512
data points as plotted in a spreadsheet, the trend line to which the data conforms
is:
y = 0.0053*n^2 –0.3601*n+39.212
R^2 = 0.9948
Figure 2-2. Comparing four sort algorithms on small data sets
Algorithms in a Nutshell
Algorithms in a Nutshell By Gary Pollice, George T. Heineman, Stanley Selkow ISBN:
9780596516246 Publisher: O'Reilly Media, Inc.
Prepared for Ming Yi, Safari ID: [email protected]
Licensed by Ming Yi
Print Publication Date: 2008/10/21 User number: 594243
© 2009 Safari Books Online, LLC. This PDF is made available for personal use only during the relevant subscription term, subject to the Safari Terms of Service. Any other use