- 1

What is the time ,space Complexity of the following code:

int a=0, b=0; for (i=0; i<N; i++){ a=a+rand(); } for(j=0;<M;j++){ b=b+rand(); } Options : 1. O(N*M)time, O(1)space 2. O(N+M)time,O(N+M)space 3. O(N+M)time,O(1)space 4. O(N*M)time,O(N+M)space Answer Option : Explanation:

7th Jul 2020, 8:09 AM
Precious Chisom Obisike
Precious Chisom Obisike - avatar
0 Réponse