Provide the Big‐O notation for the following lines of Java code, make sure you include all the necessary steps to reach your answer to receive any credit:
a. for (i = 10; i < n – 8; i++)
{
for( j = 1; j < m; j *= 2)
x = i + j;
}
b. for(k = 0; k <= m; k += 2)
{
l = 0;
while(l < n/2)
{ y = l * 4 – x; l++; }
}
c. k = n;
while (k > 1)
{
for(j = 4; j < n; j++) ;
for(i = 1; i <= n; i++)
{
System.out.println(i+k);
z = i * k;
}
k /= 2;
}
a. Number of values for i are n-8-10 = n-18 Number of values for j are log(m) as j is incrementing twice every time. So, Total time complexity = O(nlog(m)) b. Number of values for k are m/2 Number of values for l are n So, Total time complexity = O(mn) c. Number of values for k are log(n) as k is decrementing by 2 every time. Number of values for i are n Number of values for j are n-4 As two for loop as are not nested (They are parallel) So, Total time complexity = O(log(n)(n+n-4)) = O(nlog(n))

Provide the Big‐O notation for the following lines of Java code, make sure you include all...
In Java code provide the desired Big O notation methods and then call those methods in the main. Problem: Let n be the length of an integer array a, for each of the following classes ?(log(log(log(?)))) ?([log(?)] 3 ) ?(? 5 ) ?(4 ? ) ?(?!) ?(? ? ) write a method that takes as sole input an array a of length n, non-recursive, whose running time belongs to only one of the above classes.
Analyze the following code fragments and write down the Big-O estimates of the following code fragments. Provide a concise explanation how you got your answer. c. for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) cout << (j + k) << endl; } d. while (n > 1) { k += n *3; n = n / 2; } e. int temp = n; for (int j...
Analyze the following code fragments and write down the Big-O estimates of the following code fragments. Provide a concise explanation how you got your answer. c. for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) cout << (j + k) << endl; } d. while (n > 1) { k += n *3; n = n / 2; } e. int temp = n; for (int j...
Compute the Big O notation. Explain how you got the answer.
on W NA 1 public String modify (String str) { if (str.length() <= 1) return ""; int half = str.length() / 2; modify(str.substring(half)); 5} 1 2 3 for (int i = 0; i<n; i++) { for (int j 0; j < 5; j++) { for (int k = 0; k<n; k++) { 4 if ((i != j) && (i != k)) { 5 System.out.println(k); 6 } 7 } 8...
find complexity Problem 1 Find out the computational complexity (Big-Oh notation) of the code snippet: Code 1: for (int i = n; i > 0; i /= 2) { for (int j = 1; j < n; j *= 2) { for (int k = 0; k < n; k += 2) { // constant number of operations here } } } Code 2: Hint: Lecture Note 5, Page 7-8 void f(int n) { if (n...
Determine the Big 0 provide the order (Big O) of the execution
speed also determine the exact execution speed.
public class CountIt {
public long SnippetNestedLoop(long n) {
long i, j, x = 0; i=0; x++; while(i<n){ x++;
//i<n
// SomeStatement // j = 0;
// j < n
// SomeStatement // j++;
// Can you explain why is this here? // i++;
// Can you explain why is this here? Ans: i < n
} }
}
x++; return...
JAVA: What is the Big-O cost of the following code (n is a large positive integer)? int count = 0; for (int i = 1; i < n; i *= 2) { for (int k = i; k <= i + 8; k ++ ) { count ++; } }
Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i= 0; i<N; i++)
Describe the order of magnitude of the following code section using Big(O) notation j = 1; While (j < N) { j = j * 2); } Can someone give me a more Clearer answer please.
Give a big-Oh characterization, in terms of n,of the running time for each of the following code segments (use the drop-down): - public void func1(int n) { A. @(1). for (int i = n; i > 0; i--) { System.out.println(i); B. follogn). for (int j = 0; j <i; j++) System.out.println(j); c.e(n). System.out.println("Goodbye!"); D.@(nlogn). E.e(n). F.ein). public void func2 (int n) { for (int m=1; m <= n; m++) { system.out.println (m); i = n; while (i >0){ system.out.println(i); i...