Give the big-O estimate for the number of operations where an operation is an addition or a multiplication, used in this segment of an algorithm (ignoring comparison used to test the condition in the while loop). i:=1 t:=0 while i < n t:= t+2i i:= i+1
Added by Alejandro M.
Step 1
Step 1: In each iteration of the while loop, the value of i is doubled. Show more…
Show all steps
Close
Your feedback will help us improve your experience
Nick Johnson and 81 other Calculus 3 educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Give a big-O estimate for the number of operations, where an operation is an addition or a multiplication, used in this segment of an algorithm (ignoring comparisons used to test the conditions in the while or for loop). a) t := 0 for i := 1 to n for j := 1 to m t := t + i + j b) t := 0 for i := 1 to n t := t · 2 for j := 1 to m t := t + j c) t := 0 i := 1 while i ≤ n t := t - i i := i · 3
Adi S.
Give a big- $O$ estimate for the number of operations, where an operation is a comparison or a multiplication, used in this segment of an algorithm (ignoring comparisons used to test the conditions in the for loops, where $a_{1}, a_{2}, \ldots, a_{n}$ are positive real numbers). $$ \begin{array}{c}{m :=0} \\ {\text { for } i :=1 \text { to } n} \\ {\quad \text { for } j :=i+1 \text { to } n} \\ {m :=\max \left(a_{i} a_{j}, m\right)}\end{array} $$
Algorithms
Complexity of Algorithms
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD