hi, I need help figuring out how the following was calculated:

a quadratic algorithm uses 500 operations to process an input of size 10, how many operations will it use given an input of 1000?

The answer given is 5,000,000 but I can't work out how it was calculated.

Any help appreciated.

Quadratic algorithm means that for input of size n the complexity will be O(n^2). In other words the operation of the algorithm, starting for some n, will be <= C*n^2 for some number C>0. In our case 500 = 5 * 10^2. Now replace 10 with 1000 and you will get 5*1000^2 = 5,000,000. For more information about the notation read about Big-O Notation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.