Page 1 of 1

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
by answerhappygod
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 1
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 1 (126.73 KiB) Viewed 24 times
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) }