Question

Consider the following pseudocode segment. x ← 3 for i  {1, 2,   , n} do      for j  {1,...

Consider the following pseudocode segment.

x ← 3

for

i  {1, 2,   , n}

do
     for

j  {1, 2,   , n}

do
    

x ← x + 5

     for

k  {1, 2, 3, 4, 5}

do
    

x ← x + k + 1


What is the value of x after this segment runs?

Homework Answers

Know the answer?
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
Similar Questions
Answer the following questions: 1. Given the code segments below with n as the problem size,...
Answer the following questions: 1. Given the code segments below with n as the problem size, answer the following questions: //Code Segment 1 (Consider n as a power of 3) int sum = 0; for(int i = 1; i <= n; i = i*3) sum++;​​​​​​​// statement1 //Code Segment 2: (Consider both possibilities for x) if(x < 5){ for(int i = 1; i <= n; i++)    for(int k = 1; k <= i; k++)    sum++;​​​​​// statement2 } else{ for(int...
Assume evaluating a function f(n) in the pseudocode below takes theta(n) time. i = 1; sum...
Assume evaluating a function f(n) in the pseudocode below takes theta(n) time. i = 1; sum = 0; while (i <= n) do if (f(i) > k) then sum += f(i); i = 2*i; What is the
CountingSort(A, B, k) for i=1 to k C[i]= 0; for j=1 to n C[A[j]] += 1;...
CountingSort(A, B, k) for i=1 to k C[i]= 0; for j=1 to n C[A[j]] += 1; for i=2 to k C[i] = C[i] + C[i-1]; for j=n downto 1 B[C[A[j]]] = A[j]; C[A[j]] -= 1; illustrate the operation of COUNTING-SORT on the array A = {6,0,2,0, 1, 3, 5, 6, 1, 3, 2}. Specifically, show the four arrays A, B, C, and C'.
Consider the following algorithm. i ← 2 while (N mod i) ≠ 0 do i ←...
Consider the following algorithm. i ← 2 while (N mod i) ≠ 0 do i ← i + 1 Suppose instead that N is in {2, 3, 4, 5, 6, 7, 8, 9}, and all these values are equally likely. Find the average-case number of "N mod i" operations made by this algorithm.
Consider the following. f(x, y) = x/y,    P(4, 1),    u = 3 5  i + 4 5  j...
Consider the following. f(x, y) = x/y,    P(4, 1),    u = 3 5  i + 4 5  j (a) Find the gradient of f. (b) Evaluate the gradient at the point P. (c) Find the rate of change of f at P in the direction of the vector u.
Consider F and C below. F(x, y, z) = yz i + xz j + (xy...
Consider F and C below. F(x, y, z) = yz i + xz j + (xy + 18z) k C is the line segment from (1, 0, −3) to (4, 4, 1) (a) Find a function f such that F = ∇f. f(x, y, z) = (b) Use part (a) to evaluate C ∇f · dr along the given curve C.
1.) Answer the following questions based on the following pseudocode for the function “foo”: Algorithm 1:...
1.) Answer the following questions based on the following pseudocode for the function “foo”: Algorithm 1: foo mystery() foreach i ←1 to n do mystery() foreach j ←1 to i do (A) Determine the exact number of times mystery() is called in terms of n. (B) Assume the mystery function is in O(log(n) ∗ n ^2 ). Determine the complexity of “foo” in O-notation. if i ≤ j then mystery()
Consider F and C below. F(x, y, z) = yz i + xz j + (xy...
Consider F and C below. F(x, y, z) = yz i + xz j + (xy + 12z) k C is the line segment from (2, 0, −3) to (4, 6, 3) (a) Find a function f such that F = ∇f. f(x, y, z) =       (b) Use part (a) to evaluate    C ∇f · dr along the given curve C.
1. Consider three vectors: ( 8 marks) C i j k B i j k A...
1. Consider three vectors: ( 8 marks) C i j k B i j k A i j k 0ˆ 3 ˆ 5 ˆ 2ˆ 7 ˆ 1ˆ 4ˆ 6 ˆ 2 ˆ = + + = + − = + − ! ! ! 1.1 Evaluate D= 2A+B? (2 marks) 1.2 Evaluate 2A•(-­‐B) (2 marks) 1.3 Find the angle between D and 2C using cross product method (4 marks
For X1, ..., Xn iid Unif(0, 1): a) Show the conditional pdf X(i)|X(j) ∼ X(j)Beta(i, j...
For X1, ..., Xn iid Unif(0, 1): a) Show the conditional pdf X(i)|X(j) ∼ X(j)Beta(i, j − i) b Let n=5, find the joint pdf between X(2) and X(4).