Considering the following algorithm which statement is true

Considering the following algorithm, which statement is true? Assume the variable i is greater than or equal to zero. Select all that apply. public static void doSomething(int i) {doSomething(i - 1);} None of the other options. It doesn\'t have a base case, or it has one that doesn\'t execute. It doesn\'t actually do recursion. It can result in infinite recursion. Considering the following algorithm, which statement is true? Assume the variable i is greater than or equal to zero. Select all that apply. public static void doSomething(int i) {doSomething(i - 1); if(i ==0) return;} It doesn\'t actually do recursion. None of the other options. It doesn\'t have a base case, or it has one that doesn\'t execute. It can result in infinite recursion.

Solution

Answer to Question 4
-It doesn\'t have a base case, or it has that doesnt execute
-It can result in infinte recursion

Answer to Question 5
-none of the other option
It is a perfect example of recursion. It has a base condtion of returning when i==0. and it simplyfies the problem to smaller one in each iteration

//Note: Feel free to ask any doubts/queries. God bless you!

 Considering the following algorithm, which statement is true? Assume the variable i is greater than or equal to zero. Select all that apply. public static void

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site