Question

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.

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
Consider the RSA algorithm with n=33 and E=7. 1. Encode the message 8. 2. Find the...
Consider the RSA algorithm with n=33 and E=7. 1. Encode the message 8. 2. Find the value of D. 3. Decode the message 9. Consider the RSA algorithm with n=65 and E=5. 4. Encode the message 8. 5. Find the value of D. 6. Decode the message 2.
Given the following algorithm, matching each statement to the correct sequence for complexity analysis. procedure Alg3(A):...
Given the following algorithm, matching each statement to the correct sequence for complexity analysis. procedure Alg3(A): A is a list of n integers 1 for i = 1 to n-1 do 2   x=aix=ai 3 j = i − 1 4 while (j ≥≥ 0) do 5 if x≥ajx≥aj then 6 break 7 end if 8   aj+1=ajaj+1=aj 9 j = j − 1 a end while b   aj+1=xaj+1=x c end for d return A The complexity of this algorithm is O(n2)O(n2)...
Consider the following recursive algorithm. Algorithm Test (T[0..n − 1]) //Input: An array T[0..n − 1]...
Consider the following recursive algorithm. Algorithm Test (T[0..n − 1]) //Input: An array T[0..n − 1] of real numbers if n = 1 return T[0] else temp ← Test (T[0..n − 2]) if temp ≥ T[n − 1] return temp else return T[n − 1] a. What does this algorithm compute? b. Set up a recurrence relation for the algorithm’s basic operation count and solve it.
Answer the following question: 1. a. Use an affine cipher x 7→ 3x + 1 (mod...
Answer the following question: 1. a. Use an affine cipher x 7→ 3x + 1 (mod 26) to encode “Baltimore”. b. Let a and b be integers. What does it mean to say a divides b? Provide a precise definition and include the proper notation. c. Let a, b, c, and n be integers with n 6= 0. Suppose that a ≡ b (mod n) and b ≡ c (mod n). Prove that a ≡ c (mod n). d. Use...
5. (a) Find the values of 2k mod 9 where k = 1, 2, 3, 4,...
5. (a) Find the values of 2k mod 9 where k = 1, 2, 3, 4, 5, 6, 7, 8, 9. (b) Find the remainder of 2271 when this number is divided by 9. (c) Find the remainder of 2271 when this number is divided by 5. PLEASE GIVE RIGHT ANSWERS AND GOOD DETAILS ON HOW TO GET THE ANSWERS THE ANSWERS I GOT YESTERDAY FROM YOUR GUYS WERE WRONG!!!
The smallest positive solution of the congruence ax ≡ 0( mod n) is called the additive...
The smallest positive solution of the congruence ax ≡ 0( mod n) is called the additive order of a modulo n. Find the additive orders of each of the following elements by solving the appropriate congruences: (abstract algebra) (a) 20 modulo 28 (b) 8 modulo 15 (c) 7 modulo 11 (d) 9 modulo 15
Consider the following insertion sort algorithm. void insertion_sort(element a[], int n) // Put a[0]..a[n-1] into ascending...
Consider the following insertion sort algorithm. void insertion_sort(element a[], int n) // Put a[0]..a[n-1] into ascending order by insertion sort. { for (int k = 1; k < n; k++) { // At this point, a[0]..a[k-1] are already in order. // Insert a[k] where it belongs among a[0]..a[k]. You need to write code for this insertion as the body of the for-k loop. }//endfor k } a) Write the code for the body of the for-k loop to complete the...
design an efficient algorithm that, on input a set of n real numbers {x1, . ....
design an efficient algorithm that, on input a set of n real numbers {x1, . . . , xn}, outputs all distinct numbers in the set. For example, if your input is {5, 10, 9, 10, 8, 5, 12, 11, 12, 9, 7, 6, 8, 5}, then you should output {5, 10, 9, 8, 11, 12, 7, 6} (any ordering of these number is acceptable).
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number...
1. Given an n-element array A, Algorithm X executes an O(n)-time computation for each even number in A and an O(log n)-time computation for each odd number in A. What is the best-case running time of Algorithm X? What is the worst-case running time of Algorithm X? 2. Given an array, A, of n integers, give an O(n)-time algorithm that finds the longest subarray of A such that all the numbers in that subarray are in sorted order. Your algorithm...
Consider the model Yi = 2 + βxi +E i , i = 1, 2, ....
Consider the model Yi = 2 + βxi +E i , i = 1, 2, . . . , n where E1, . . . , E n be a sequence of i.i.d. observations from N(0, σ2 ). and x1, . . . , xn are given constants. (i) Find MLE for β and call it β. ˆ . (ii) For a sample of size n = 7 let (x1, . . . , x7) = (0, 0, 1, 2,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT