两个不同算法的优劣关键是增长率 Algorithm 2 3 4 Time function(ms) 33n 46nlg n 13n2 3.4n 2n Input size(n) Solution time 10 0.00033sec. 0.0015 0.0013sec. 0.0034sec. 0.001sec sec. 100 0.0033sec. 0.03 sec 0.13 sec 3.4 sec. 4×1016yr. 1,000 0.033sec. 0.45 sec. 13 sec. 0.94hr. 10,000 0.33sec. 6.1 sec. 22 min. 39 days 100,000 3.3 sec. 1.3 min. 1.5 days 108yr. Time allowed Maximum solvable input size (approx.) 1 second 30,000 2,000 280 67 20 1 minute 1.800.000 82.000 2.200 260 26两个不同算法的优劣关键是”增长率” Algorithm 1 2 3 4 5 Time function(ms) 33n 46n lg n 13n 2 3.4n 3 2 n Input size(n) Solution time 10 0.00033 sec. 0.0015 sec. 0.0013 sec. 0.0034 sec. 0.001 sec. 100 0.0033 sec. 0.03 sec. 0.13 sec. 3.4 sec. 41016 yr. 1,000 0.033 sec. 0.45 sec. 13 sec. 0.94 hr. 10,000 0.33 sec. 6.1 sec. 22 min. 39 days 100,000 3.3 sec. 1.3 min. 1.5 days 108 yr. Time allowed Maximum solvable input size (approx.) 1 second 30,000 2,000 280 67 20 1 minute 1,800,000 82,000 2,200 260 26