What is the most efficient way to fix the time complexity of an algorithm? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: What is the most efficient way to fix the time complexity of an algorithm? (/showthread.php?tid=86086) What is the most efficient way to fix the time complexity of an algorithm? - Sprint - 01-08-2023 I have looked through Google and resource for a clear and straightforward explanation of how to calculate time complexity, but I have yet to find one. What information do I already have? The following code is: Code:```char h = 'y'; // This will be executed 1 time int abc = 0; // This will be executed 1 time``` The following loop is like the one below: Code:```for (int i = 0; i < N; i++) {     Console.Write('Hello, World!!'); }```This will be executed only once.int i=0; This will be executed only once. The time is actually calculated to i=0 and not the declaration.i < N; This will be executed N+1 times i++ This will be executed N times The number of operations needed to complete this loop is {1+(N+1)+N}= 2N+2. I am familiar with the basics of time complexity calculations but have seen complexity measured in terms of O(N), O(n^2), O(log n), O(n!), and other forms.