Question
could you please help me ?
Q1. Count the total number of multiplications and divisions in the following code in terms on n. Assume that the values of al
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CLSSTE Page No Date O a end end enol Cf endand 8o om. tn other erahon So, (n-1) + (n2In3)CLASSTIME Page No, Date L Hme 2- 2. the answer we constder both molh pu- -caton and diuision sebarately ThenCLASSTIME Page No. Date cattoo L2 2

Add a comment
Know the answer?
Add Answer to:
Q1. Count the total number of multiplications and divisions in the following code in terms on n. ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q1. Count the total number of multiplications and divisions in the following code in terms on...

    Q1. Count the total number of multiplications and divisions in the following code in terms on n. Assume that the values of all variables are given for k-1:n-1 for i-K+1:n end end X(n)-B(n)/A(n,n); for i-n-1:-1:1 for j-i+1:n s-s-A(ij)*XG); end

  • 4. [16 marks total (6 marks each)] Do a worst-case analysis for the following algorithm segments, counting the number of multiplications which occur. I have marked the lines with the multiplications...

    4. [16 marks total (6 marks each)] Do a worst-case analysis for the following algorithm segments, counting the number of multiplications which occur. I have marked the lines with the multiplications you are to count with ). For all of these algorithms, use n as your fixed input size (even though n doesn't really represent the "size" of the input). Be sure to include an explanation with your answers to obtain full marks. (a) t-10; for (i-1;in-H) t-5*t; (b) (For...

  • Need to find number of elementary expressions in terms of n, not looking for Big O...

    Need to find number of elementary expressions in terms of n, not looking for Big O complexity. 4. Work out the number of elementary operations in the worst possible case and the best possible case for the following algorithm (justify your answer): 0: function Nonsense (positive integer n) 1: it1 2: k + 2 while i<n do for j+ 1 to n do if j%5 = 0 then menin else while k <n do constant number C of elementary operations...

  • Answer the following questions I want to double check my work

    Answer the following questions I want to double check my work Q1: (8086 processor) Translate the following code segment written in high level languages into assembly code. Assume Ax contains signed number. If AX >=2 then CX=CX+1 ; Else AX-CX; End Q2: Show how this statement M JK-1 could be translated into assembly code using 8086 instruction set a) b) MIPS instruction set Assume M. J and K are memory variables In s086 assume 16-bit, we can use MOv instruction...

  • 8.         R-4.8 Order the following functions by asymptotic growth rate. 4nlogn + 2n 2^10    2^logn 3n...

    8.         R-4.8 Order the following functions by asymptotic growth rate. 4nlogn + 2n 2^10    2^logn 3n + 100logn      4n     2^n n^2 + 10n        n^3       nlogn 9.         R-4.9 Give a big-Oh characterization, in terms of n, of the running time of the example 1 method shown in Code Fragment 4.12. 10.       R-4.10 Give a big-Oh characterization, in terms of n, of the running time of the example 2 method shown in Code Fragment 4.12. 11.       R-4.11 Give a big-Oh characterization, in...

  • Cache performance The starting code would have: struct position { int x; int y; } int...

    Cache performance The starting code would have: struct position { int x; int y; } int N; struct position grid[N][N]; int totalX=0; int totalY=0; int i, j; //For X loop for( i = 0; i < N; i ++){ for( j = 0; j < N; j++){ totalX += grid[i][j].x; } } //For Y loop for( j = 0; j < N; j++){ for( i = 0; i < N; i++){ totalY += grid[i][j].y; } } Part I: This part...

  • I'm having trouble sorting this square matrix (a 2d array that has number of rows and...

    I'm having trouble sorting this square matrix (a 2d array that has number of rows and same number of column n x n) using row-wise approach in C programming. Please help me program this in C to sort it using row-wise approach, here is the code: #include <stdio.h> #define MAX 100 int main() { int mat[MAX][MAX]; int i, j, m, n; int rowsum, columnsum, diagonalsum; int k; int magic = 0; int transpose[MAX][MAX]; printf("Enter the # of rows and columns...

  • Show your work Count the number of operations and the big-O time complexity in the worst-case...

    Show your work Count the number of operations and the big-O time complexity in the worst-case and best-case for the following code int small for ( i n t i = 0 ; i < n ; i ++) { i f ( a [ i ] < a [ 0 ] ) { small = a [ i ] ; } } Show Work Calculate the Big-O time complexity for the following code and explain your answer by showing...

  • help me pls Constants I Periodic Table Port A A mass m is at rest on...

    help me pls Constants I Periodic Table Port A A mass m is at rest on the end of a spring of spring constant k. At t 0 it is given an impulse J by a hammer. Write the formula for the subsequent motion in terms of m, k, J, and t. Assume x = 0 at t = 0. Express your answer in terms of the variables m, k, J, t, and appropriate constants. Submit Request Answer

  • Problem 5. Indicator variables S points possible (graded) Consider a sequence of n 1 independent tosses...

    Problem 5. Indicator variables S points possible (graded) Consider a sequence of n 1 independent tosses of a biased coin, at times k = 0,1,2,...,n On each toss, the probability of Heads is p, and the probability of Tails is 1 -p {1,2,.., at time for E resulted in Tails and the toss at time - 1 resulted in A reward of one unit is given if the toss at time Heads. Otherwise, no reward is given at time Let...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT