Consider four algorithms for doing the same task with exact running times of n log2 n, n 2 , n 3 , and 2n (the algorithms take n log2 n, n 2 , n 3 , and 2n operations to solve the problem), respectively, and a computer that can perform 10^10 operations per second. Determine the largest input size n that can be processed on the computer by each algorithm in one hour.
Consider four algorithms for doing the same task with exact running times of n log2 n,...
11. (12 marks 4x 3 marks) Consider four algorithms for doing the same task with exact running times of n log2 n, n', », and 2n, respectively, and a computer that can perform 1010 operations per second. Determine the largest input size n that can be processed on the computer by each algorithm in one hour
Algorithms A and B perform the same task. On input of size n, algorithm A executes 0.003n2 instructions, and algorithm B executes 243n instructions. Find the approximate value of n above which algorithm B is more efficient. (You may use a calculator or spreadsheet.)
Assume that algorithm A1's running time roughly equals to T1(n) = 4n^2 + 2n + 6 and algorithm A2's running time roughly equals to T2(n) = 2n lg(n) + 10 . Suppose that Computer A's cpu runs 10^8 instructions/sec. When the input size equals to 10^4, 10^6, and 10^12 respectively, how long will algorithm A1 take to finish for each input size in the WORST case? How long will algorithm A2 take to finish for each input size in the...
Problem 2. (5 pts.) Algorithms A and B perform the same task. On input of size n, algorithm A executes 10 n 2 steps, and algorithm B executes 100,000 steps. Find the value of n above which algorithm B is more efficient. Show your work.
Several algorithms have a loop structure that iterates n times and for the k-th iteration, they perform on the order of k2 operations. In this case, the running time of the loop can be obtained by k2. In this problem, we will derive a closed formula for this sum and show that the sum is O(ui) 1. A telescoping sum is a sum of the form Σ-i (aj - a-1). It is easy to see that this sum equals an...
Consider two algorithms A1 and A2 that have the running times T1(n) and T2(n), respectively. T1(n) = n3 + 3n and T2(n) = 50n2. Use the definition of Ω() to show that T1(n) € Ω(T2(n))
** Use Java programming language Program the following algorithms in JAVA: A. Classical matrix multiplication B. Divide-and-conquer matrix multiplication In order to obtain more accurate results, the algorithms should be tested with the same matrices of different sizes many times. The total time spent is then divided by the number of times the algorithm is performed to obtain the time taken to solve the given instance. For example, you randomly generate 1000 sets of input data for size_of_n=16. For each...
You are given an algorithm that uses T(n) a n2b.3" basic operations to solve a problem of size n, where a and b are some real non-negative constants. Suppose that your machine can perform 400,000,000 basic operations per second (a) If a = b = 1, how long does it take for your algorithm to solve problems of size n = 10, 20, 50. For each size of n, include the time in seconds and also using a more appropriate...
Problem 2.15. A certain algorithm takes 10-4 2n seconds to solve an instance of size n. Show that in a year it could just solve an instance of size 38. What size of instance could be solved in a year on a machine one hundred times as fast? A second algorithm takes 10-2 x n3 seconds to solve an instance of size n. What size instance can it solve in a year? What size instance could be solved in a...
1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You know that in the worst case the running times are Ti(n) = 101#nº + n, Ta(n) = 10”, TS(n) = 101 nº logo n10 (a) Which algorithm is the fastest for very large inputs? Which algorithm is the slowest for very large inputs? (Justify your answer.) (b) For which problem sizes is Al the best algorithm to use (out of the three)? Answer the...