NICOLAS GUARINI — M. 918670 — [email protected]


Identify the LSCAJs for the following 2 programs:

public boolean palindrome(String str) {
    int len = str.length();
    for (int i = 0; i < Math.floor(len / 2); i++) {
        if (str.charAt(i) != str.charAt(len - 1 - i)) {
            return false;
        }
    }
    return true;
}

Untitled

From Sequence of Basic Blocks To
entry B1 B2 B3 JA
entry B1 B2 B3 JB
JA B5 return
JB B4 JD
JB B4 JC
JC B6 return
JD B7 JE
JE B3 JA
JE B3 JB
public boolean is_prime_decomposition(int number, int i) {
    if (number % i == 0) {
        for (int j = 2; j <= i / 2; j++) {
            if (i % j == 0) {
                return false;
            }
        }
        return true;
    } else {
        return false;
    }
}

Untitled

From Sequence of Basic Blocks To
entry B1 B2 B4 return
entry B1 B2 B3 JA
JA B5 JB
JA B5 JC
JB B7 return
JC B6 JE
JC B6 JD
JD B8 return
JE B9 JA