Taking a stab at this I would think that number 1 would be n-1 additions for 2(a
ID: 3421541 • Letter: T
Question
Taking a stab at this I would think that number 1 would be n-1 additions for 2(a), n-1 additions for 2(b), n-1 additions for 2(c) and we can only exit step 2 when k =n thus we have n comparisons. So would the answer to this be 4n-3?
For number 3:
Step 2 has n-1 additions (2a) and 2(b) and 2(c) are only replacing so they are not counted and then another n-1 additons for 2(d). Since step 2 keeps going until k=n we have n comparisons. Thus the equation would be 3n - 2 is this also correct?
Thanks for the help!
Explanation / Answer
2) 2.a t+d=a+d
b.s+a =a+a
c. k=k+1
3. if n=k then exit
3(n-1)+n
=3n-3+n
=4n-3
3) yes here
as above have two addtitions and two not have any operations
and n comparaasions.
= 2(n-1)+n
= 2n-2+n
=3n-2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.