Lines 1- neg = false; 2- if (n<0) 3- { 4- 5- 6- } 7- if (n==0) 8- 9- p = 1; 10- for (i=1; i<=n; i++) 11- p*= x 12- if (neg) 13- n = -n; neg = true; return 1; // stop code execution p = 1.0/p; 14- return p; Total Frequency Count, T(n) Big-O notation, O(?) → Constant/Linear/Quadratic/Cubic (?) → Best/Average/Worst (?) → if n<0 O(?) Frequency Count if n=0 O(?) if n>0 O(?)

icon
Related questions
Question

PROVIDE THE FREQUENCY COUNT OF EACH STATEMENT. ALSO THE BIG-O NOTATION ASAP. DSA

Lines
1-
2-
3-
4-
neg = false;
if (n<0)
{
n = -n;
neg = true;
5-
6-
7-
8-
9-
p = 1;
10- for (i=1; i<=n ; i++)
11-
p*= x
}
if (n==0)
return 1; // stop code execution
12- if (neg)
13-
p = 1.0/p;
14- return p;
Total Frequency Count, T(n)
→
Big-O notation, O(?)
Constant/Linear/Quadratic/Cubic (?) →
Best/Average/Worst (?)
→
if n<0
O(?)
Frequency Count
if n=0
O(?)
if n>0
O(?)
Transcribed Image Text:Lines 1- 2- 3- 4- neg = false; if (n<0) { n = -n; neg = true; 5- 6- 7- 8- 9- p = 1; 10- for (i=1; i<=n ; i++) 11- p*= x } if (n==0) return 1; // stop code execution 12- if (neg) 13- p = 1.0/p; 14- return p; Total Frequency Count, T(n) → Big-O notation, O(?) Constant/Linear/Quadratic/Cubic (?) → Best/Average/Worst (?) → if n<0 O(?) Frequency Count if n=0 O(?) if n>0 O(?)
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer