- R 4 11 Give A Big Oh Characterization In Terms Of N Of The Running Time Of The Example3 Method Shown In Code Fragment 1 (156.75 KiB) Viewed 21 times
R-4.11 Give a big-Oh characterization, in terms of n, of the running time of the example3 method shown in Code Fragment
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
R-4.11 Give a big-Oh characterization, in terms of n, of the running time of the example3 method shown in Code Fragment
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) }