Time and Space

Question 1: What is the time, space complexity of following code:

int a = 0, b = 0;

for (i = 0; i < N; i++) {

a = a + rand();

}

for (j = 0; j < M; j++) {

b = b + rand();

}

Output:

Explanation:

Question 2: Construct a TM which accepts the language of aba over ∑ = {a, b}.

This question has been answered.

Get Answer