Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There are six different methods in this task. The task is to indicate for which methods the estimated growth of the calculation time, ie the
There are six different methods in this task. The task is to indicate for which methods the estimated growth of the calculation time, ie the time complexity, is: 0 (1), for which it is 0 ((log (n)), for which it is 0 (n), for which it is 0 (nlog (n)), for which it is 0 (n ^ 2), and for which it is 0 (n ^ 3). In AlgF it is assumed that number is positive.
I denna uppgift frekommer sex olika metoder. Uppgiften r att ange fr vilka metoder den uppskattade tillvxten av berkningstiden, allts tidskompexiteten, r: 0(1), fr vilka den r O(log(n)), fr vilka den r O(n), fr vilka den r O(nlog(n)), fr vilka den r 0(na), och fr vilka den r 0(ny). I AlgF antas att tal r positivt. public static boolean algA(int[] a) { int n = a.length; Arrays. sort(a); int i = 0; int j = n-1; while (i a[j+1]) { int temp = a[j+1]; al j+1] = a[j]; a[j] = temp; } return a; public static int alg(int n) { if (n == 0) return 0; return n + algC(n/2); } } public static double algF(double tal) { double tollerans = 1/Math.pow(10, 10); double tal2 = tal/2; int n = 0; public static boolean alge(int[] a) { int n = a.length; for (int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started