Question: 8) What does the following method do? Rewrite it so it produces the same results but does not use recursion. public static boolean whoKnows

 8) What does the following method do? Rewrite it so it produces   

8) What does the following method do? Rewrite it so it produces the same results but does not use recursion. public static boolean whoKnows (int arr, int i, int j) { if (i >= j) { return true; } else { int mid = (i + j) / 2; boolean leftOk == whoKnows (arr, i, mid); } } boolean right0k = whoKnows (arr, mid + 1, j); return leftOk && rightOk && arr[mid]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!