Solved

Which of the Following Recursive Methods Would Execute Approximately Log

Question 27

Multiple Choice

Which of the following recursive methods would execute approximately log ₂ n times for an initial parameter n?


A) public void logcode(int n) {
If (n > 1) logcode(n - 1) ;
}
B) public void logcode(int n) {
If (n > 2) logcode(n - 2) ;
}
C) public void logcode(int n) {
If (n > 0) logcode(0) ;
}
D) public void logcode(int n) {
If (n > 1) logcode(n / 2) ;
}
E) public void logcode(int n) {
If (n > 1) logcode(n - 1 /2) ;
}

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions