Module B:
A.state = rand() % 4;
if (A.state == 1 && globaltime == 6) {
Module C:
private int Cstate;
parameters i, j1;
// a call without defining parameter j is fine if i % 2
C.state = 7;
} else {
C.state = 100;
return C.state + rand() % 4;
}
Module D:
if (moduleC(rand() % 8) > 10) {
pua >> oo >> ano;
}
5. Coding with quality request:
Provide brief analysis and justification of the time complexities for all questions.
a) 8pts: For a sorted array A of n different elements ranging from 1 to n, suppose one element is randomly chosen. Complexity O(log n) to seek out the only repeated element.
b) 8pts: Recursive callings.
Then C[5]. Your code should handle all possible cases that may arise.