88804/how-to-find-the-time-complexity-of-a-program
Hi Team,
I am new to DSA. I want to find the time complexity of the below program. How can I get that?
int a = 0, b = 0; for (i = 0; i < N; i++) { a = a + rand(); } for (j = 0; j < M; j++) { b = b + rand(); }
Hi@akhtar,
The first loop is O(N) and the second loop is O(M). Since we don’t know which is bigger, we say this is O(N + M). This can also be written as O(max(N, M)). You can also find how much this program will consume using the time command in Linux.
I don't think post-process is what you ...READ MORE
Its so simple.... If you want to ...READ MORE
Hey @Sid, do check if this link ...READ MORE
Hey there! Please refer to the following ...READ MORE
Hi Pratibha, installing ROR on ubuntu is ...READ MORE
Hi@akhtar, You need to install the module in ...READ MORE
Hi@akhtar, If you are trying to install with pip ...READ MORE
Hi@akhtar, In your TextField, you can call one ...READ MORE
Hi@akhtar, You can add backgroundColor keyword in your ...READ MORE
OR
Already have an account? Sign in.