R-4.11 Give a big-Oh characterization, in terms of n, of the running time of the example3 method shown in Code Fragment
Posted: Mon Jun 06, 2022 5:15 pm
R-4.11 Give a big-Oh characterization, in terms of n, of the running time of the example3 method shown in Code Fragment 4.12 16 17/ Returns the sum of the prefix sums of given array. */ 18 public static int example3(int[] arr) { 19 int n arr.length, total = 0; 20 for (int i=0; j<n; j++) 21 // loop from 0 to j for (int k=0; k<=j; k++) total += arr[j]; 22 23 return total; 24 25 ○ 0(n²) ○ 0(n³) 0 (en) O (n logn) }