Package edu.princeton.cs.algs4
Class DoublingRatio
- Object
-
- edu.princeton.cs.algs4.DoublingRatio
-
public class DoublingRatio extends Object
TheDoublingRatio
class provides a client for measuring the running time of a method using a doubling ratio test.For additional documentation, see Section 1.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
- Author:
- Robert Sedgewick, Kevin Wayne
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
main(String[] args)
Prints table of running times to callThreeSum.count()
for arrays of size 250, 500, 1000, 2000, and so forth, along with ratios of running times between successive array sizes.static double
timeTrial(int n)
Returns the amount of time to callThreeSum.count()
with n random 6-digit integers.
-
-
-
Method Detail
-
timeTrial
public static double timeTrial(int n)
Returns the amount of time to callThreeSum.count()
with n random 6-digit integers.- Parameters:
n
- the number of integers- Returns:
- amount of time (in seconds) to call
ThreeSum.count()
with n random 6-digit integers
-
main
public static void main(String[] args)
Prints table of running times to callThreeSum.count()
for arrays of size 250, 500, 1000, 2000, and so forth, along with ratios of running times between successive array sizes.- Parameters:
args
- the command-line arguments
-
-