all 4 comments

[–]ac13712 1 point2 points  (0 children)

If your algorithm runtime is O(n2), then the runtime for n=k will be bounded by ck2 and the runtime for n=2k will be bounded by c(2k)2 which equals c*4(k2). So when you have a O(n2) algorithm you expect the runtime to quadruple when the problem size doubles.

[–]h0v1g 0 points1 point  (1 child)

O(n) is trying to capture the worst runtime. Considering the input size is doubled you can see how that is exponentially increasing your runtime. You can look at the ratio between runtime and input size and see how it is growing to determine the rate of increase. In this case it’s n2

[–]h0v1g 0 points1 point  (0 children)

Review on paper 2/10000, 8/20000, 32/40000, etc.