Question 1: Growth Analysis ...... .... 10 points For each of the below code snippets, identify the asymptotic runtime (
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Question 1: Growth Analysis ...... .... 10 points For each of the below code snippets, identify the asymptotic runtime (
Question 1: Growth Analysis ...... .... 10 points For each of the below code snippets, identify the asymptotic runtime (i.e., big-Oh) of the code segment: (a) (2 points) int a = 0; int b = 0; On On On int m - non; while(a <n) logn On logn On" Other: a=a+1; while(b <m/100) b=b+1; 1 On 2 (b) (2 points) for (i = 1; i<n; i-1*3) for(j = 0; j<n; j++) printf("Hello world\n"); 01 On On On Onn logn On logn 2" On" Other: (c) (2 points) int rec int n){ if(n=1 ) return 0; return 1 + rec(n-3); /* rec call */ } 1 On n2 On On logn On logn 02" On" Other: (d) (2 points) for(i = 0; i <n; i++) for(j = 0; j <i; j++) arr += arr[j]; 1 On On O logn On logn Other: 00 (e) (2 points) for (i = 0; i < 1000; i++) { for(j = i; j > 0; j--) { arr[j] [k] = 0; } } 1 On On On On logn On login 02" On" Other:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!