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.
Use MailItem.ReceivedTime property. I hope this helps you ...READ MORE
I m having trouble connecting to the ...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
What is the shortest and most efficient ...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
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.