{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw1_sol_rev2

# hw1_sol_rev2 - K Olukotun M.T Le Winter 2003-2004...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
K. Olukotun / M.T. Le Handout #13 Winter 2003-2004 EE108b b. (3 points) What is the total number of instructions that are executed in this piece of code? Briefly explain the number of instructions executed in each loop (e.g. There are 5 instructions that are executed once before loop outer , there are 8 instructions in loop inner that are executed 10 times, etc.). First, we ignore the 4 instructions before the loops. Next we consider the outer loop, it: iterates 5000 times has 4 instructions before the inner loop has 6 instructions after the inner loop in the worst case. Thus, the number of instructions for the outer loop is: (4 + 6) instructions/iteration x 5000 iterations = 5 x 10 4 instructions Now we examine the inner loop, it: has 6 instructions per iteration repeats 5000
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

hw1_sol_rev2 - K Olukotun M.T Le Winter 2003-2004...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online