procedure polynomial (?,?0,?1,…,??)
?????∶=1
?≔?0
??? ?=1 ?? ?
?????≔?????∗?
?≔?+??∗?????
?????? ?
Find a big-? estimate for the number of additions and
multiplications used by this algorithm.
procedure polynomial (?,?0,?1,…,??) ?????∶=1 ?≔?0 ??? ?=1 ?? ? ?????≔?????∗? ?≔?+??∗????? ?????? ? Find a big-?...
) Consider the following algorithm procedure polynomial (c, a0,a1, …, an) power :=1 y≔a0 for i=1 to n power≔power*c y≔y+ai*power return y Find a big-O estimate for the number of additions and multiplications used by this algorithm.
consider this segment of an algorithm: for i := 1 ton n for j:=1 to n top:=ij+j+10 a. find a function f(n) that counts the number of multiplication and additions performed in this segment. b. Give a big O estimate for the number of additions and multiplications used in the segment
Show that the number of multiplications used in this algorithm is Consider the following algorithm: procedure multiplications(n: positive integer) for i := 1 to n for j:-1 to i t_2.t return t O (n2) 7l
Give a big-O estimate for the number of additions ued in the segment of an algorithm below. t:=0 for i := 1 to n for j := 1 to n t := t + i + j
Discrete Math Give a big-Theta estimate for the number of additions in the following algorithm a) procedure f (n: integer) bar = 0; for i = 1 to n^3 for j = 1 to n^2 bar = bar + i + j return bar b) Consider the procedure T given below. procedure T (n: positive integer) if n = 1 return 2 for i = 1 to n^3 x = x + x + x return T(/4) + T(/4) +...
What is the time-complexity of the algorithm abc? Procedure abc(n: integer) s := 0 i :=1 while i ≤ n s := s+1 i := 2*i return s consider the following algorithm: Procedure foo(n: integer) m := 1 for i := 1 to n for j :=1 to i2m:=m*1 return m c.) Find a formula that describes the number of operations the algorithm foo takes for every input n? d.)Express the running time complexity of foo using big-O/big-
Problem 1. Given a polynorial p(x) anz" + an-lz"-ı + + aix + ao, where the coefficients are a,'s, Horner's method is an efficient algorithm for evaluating the polynomial at a number c that works as follows: Multiply an by c, then add an-1. Then multiply the result by c and add an-2. Then multiply the result by c and add an-3 and so on until you reach a0. This over all gives an O(n) algorithm for evaluation of p(c)...
i=n Consider the following procedure to evaluate a polynomial a;x' at x = C. i = 0 procedure poly(ca ,...an power + 1 y cao for i from iton power + power * y+y+a; power return y where + denotes assignment, * denotes multiplication. Evaluate 3x2 + x + 1 at x = 2 by stepping through the algorithm.
3) [16 points totall Consider the following algorithm: int SillyCalc (int n) { int i; int Num, answer; if (n < 4) 10; return n+ else f SillyCalc(Ln/4) answer Num Num 10 for (i-2; i<=n-1; i++) Num + = answer + answer; answer return answer } Do a worst case analysis of this algorithm, counting additions only (but not loop counter additions) as the basic operation counted, and assuming that n is a power of 2, i.e. that n- 2*...
Your are given the intial value problem y 0 = P(t)y + g(t) with y(0) = 1 2 , P(t) = 1 t + 1 t 1 and g(t) = 2 1 . Estimate y(2) using the step size h = 1. Complete vector additions, scalar multiplications and arithmetic operations. 1 t+1 10. Your are given the intial value problem y,-P(t)y+g(t) with y(0) = (10 points) , P(t) and g(t)- Estimate y(2) using the step size h -1. Complete vector...