1. I need help on (d) 1. Select the appropriate \"Big-Oh\" notation from among:
ID: 3853943 • Letter: 1
Question
1. I need help on (d)
1. Select the appropriate "Big-Oh" notation from among: 0(1), 0(n), O(nlg n), 0(), 0(n*), 0(2n) for the number of times that “x (a) to (d). a) x+1" will be executed in exercises for i = 1 to 3n x = x+1 b) for i = 1 to n for j 1 to (2n-1) for k 1 to (3n-2) c) i=n while (i 2 1) ( for j 1 to n x = x+1 floor (1/2) i floor (i/2) = = // floor of a number is the largest integer // that is less than the number // E.G, floor (3.7) -3; floor (10.43) = 10 //thaorislesnumbertset d) if (x 3) x = x+1 elseExplanation / Answer
Since the (d) part do not contain any kind of loop this means the number of times the expression is executed can be given by O(1) irrespective of If statement. It doesn't matter whether you consider If or not as we are calculating BigO.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.