The method findLargest examines the elements of an array arr…

The method findLargest examines the elements of an array arr which contains non-negative values public static int findLargest(int[] arr) { int curLargest = -1; for (int i = 0; i < arr.length; i++) { if (arr[i] >= curLargest) { curLargest = arr[i]; } } return curLargest; } What can you conclude about the running time of this section of code?

Consider the method powerOfTwo shown below: public boolean…

Consider the method powerOfTwo shown below: public boolean powerOfTwo(int n) { if (n == 1) // line #1 { return true; } else if (n % 2 == 1) // line #2 { return false; } else { return powerOfTwo(n / 2); // line #3 } } What is the best interpretation of line #1?

Consider the method below, which displays the characters fro…

Consider the method below, which displays the characters from a String in reverse order.  Each character appears on a separate line.  Select the statement that should be used to complete the method so that it performs a recursive method call correctly. public static void printReverse(String word) { if (word.length() > 0) { ___________________________ System.out.println(word.charAt(0)); } }