Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating complexity of algorithm

I am not sure if this is a valid question.

Let's assume there is an O(n^3) algorithm which sorts 100 numbers per day with a computing power x.

How many numbers will it be able to sort if the computing power is doubled ie., 2x .

I understand that i din't define 'computing power'. Please correct the question if it is ambiguous or wrong.

like image 678
Vinoth Kumar C M Avatar asked Dec 16 '22 12:12

Vinoth Kumar C M


1 Answers

Big O notation does not give you eact time (real computer time). It is a method that try to understand effiency of algorithms independent of cpu or other specific computer features.

In mathamatics perpective, you can say that O(n^2) is more efficient than O(n^3). But in an engineer view point, for some values of n , O(n^3) can be better than O(n^2). This methods just says that for suffieciently large n, O(n^2) will be more efficient than O(n^3).

There is a good introduction to algorithm analsysis in you tube. First chapter is good for explaning those things: MIT 6.046J / 18.410J Introduction to Algorithms

The Big O notation can only say that for the same machine, for sufficiently large n, O(n^2) is better than O(n^3). But for the same algorithm i think you can not make direct propotion betweeen computer power and output. If we double the computer power, the output doubled? Maybe yes but may be not. I think we can not say such a thing by just looking algorithm Big O.

enter image description here

like image 68
Novalis Avatar answered Dec 19 '22 01:12

Novalis