R-4.9 Give a big-Oh characterization, in terms of n, of the running time of the example1 method shown in Code Fragment 4
Posted: Mon Jun 06, 2022 5:14 pm
R-4.9 Give a big-Oh characterization, in terms of n, of the running time of the example1 method shown in Code Fragment 4.12 1/** Returns the sum of the integers in given array. */ 2 public static int example1(int[] arr) { 3 int n = arr.length, total = 0; 4 for (int i=0; j<n; j++) // loop from 0 to n-1 5 total += arr[j]: 6 return total; 7 8 O(n) ○ 0(n²) O (log n) 0 (en) }