Jacob Sonia wrote:
I am really not able to understand how exactly do we calculate the O(n) of any algorithm. suppose my algorithm has a complexity of 3n/2 + 1 then how would i say what is O(n) of it. Please help me understand that. any pointers would be useful
The Ordo system is concerned with the overall complexity. In an expression like 3n/2 + 1 you pick the worst contribution and remove the multiplicative constant. This gives you O(n). This tells you that the complexity is linear. I means that if you double the data input, the execution time will double. Any expression describing a line (is of the form k*n + m) belongs to the same category, that is O(n).