A program with a quadratic run time takes t seconds to run, when given an input size n. If the same algorithm is given input of size 2n, then the program will take approximately how many seconds?
a. 2t
b. t
c. 4t
d. 6t
A program with a quadratic run time takes t seconds to run, when given an input size n. If the same algorithm is given input of size 2n, then the program will take approximately 4t seconds
c. 4t
A program with a quadratic run time takes t seconds to run, when given an input...
Suppose that an algorithm has run-time proportional to 2n , where n is the input size. The algorithm takes 1 millisecond to process an array of size 10. How many milliseconds would you expect the algorithm take to process an array of size 20 ?
QUESTION 5 A program P takes time proportional to n log n where n is the input size. If the program takes 4 seconds to process input of size 100,000,000, how many microseconds does it take to process input of size 10,000? QUESTION 6 algorithm An example of a graph problem that can be solved in polynomial time is (Hint: Starts with 'D' You're allowed to research this one online if you don't know it.)
Suppose that an algorithm takes 30 seconds for an input of 224 elements (with some particular, but unspecified speed in instructions per second). Estimate how long the same algorithm, running on the same hardware, would take if the input contained 230 elements, and that the algorithm's complexity function is: Big theta not Big O a) Big theta(N) b) Big theta (log N) c) Big theta (N log N) d) Big theta(N^2) Assume that the low-order terms of the complexity functions...
A certain computer algorithm executes three times as many operations when it is run with an input of size n as when it is run with an input of size n -1 (where n > 1 is an integer). When the algorithm is run with an input of size 1, it executes ten operations. Let sn be the number of operations the algorithm executes when it is run on an input of size n. Find a closed form for s....
For part (b), An algorithm takes 0.5 ms for input size 100. How large a problem can be solved in 1 min if the running time is the following (assume low-order terms are negligible): a. linear b. O(NlogN) c. quadratic d. cubic
Linda creates an algorithm that takes an input sequence S and produces an output sequence T that is a sorting of the n elements of S. a) In Java, give an algorithm, isSorted, for testing in O(n) time if T is sorted. b) Explain why the algorithm isSorted is not sufficient to prove a particular output T of Linda's algorithm is a sorting of S. c) Describe what additional information Linda's algorithm could output so that her algorithm's correctness could...
Q1: 20% of the instructions in a program take 1 nsec to execute, 30% take 2 nsec to execute,and the rest take 3 nsec to execute. What is the average execution time per instruction for this program? Q2: Computer A is 60% faster than computer B. Computer A takes ten seconds to run a program. How long will computer B take to run the same program? Q3: Computer B is 60% slower than computer A. Computer A takes ten seconds...
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...
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...
Create a program that takes in user input and stores the input into an array. Also within the program show how you can: show the elements in the array, remove an element from the array, add an element to the array. Do NOT ask the user how many elements they want to add, instead once they are done adding, they should hit ‘q’ and it should break out of the input. This is a c++ program. The input type shall...