What is the runtime complexity of the following getMinimum()…
What is the runtime complexity of the following getMinimum() method, assuming that the problem size N is the input parameter size (the number of elements stored in the array data)? /** * Recursive method which returns the minimum element of an oversize array * @param data a non empty oversize array * @param size number of elements stored in an oversize array * @return the minimum element of the oversize array data */ public static int getMinimum(int[] data, int size) { if (size == 1) return data[size-1]; return Math.min(data[size-1], getMinimum(data, size-1)); }
Read Details