Question 1: Growth Analysis ...... .... 10 points For each of the below code snippets, identify the asymptotic runtime (
Posted: Sun May 15, 2022 8:43 am
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: