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 ?
Suppose that an algorithm has run-time proportional to 2n , where n is the input size....
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.)
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
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...
Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32. What is input size makes the algorithm run for 14 milliseconds?
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....
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...
You are given an input of k arrays each of size n. Each one of the k arrays is sorted. Give an algorithm that turns the k sorted arrays into one sorted array of k * n elements. Please explain the algorithm in words and analyze the run time.
In this project, you will work on the algorithm (discussed in Module 1) to determine the length of the longest sub sequence of consecutive integers in an array You will implement the algorithm using Hash tables. You are provided with sample code (in C++ and Java) representing the linked list-based implementation of Hash tables (as an array of Linked Lists). You could go through the code to understand the implementation of a Hash table and the functions that can be...
For an O(Nk ) algorithm, where k is a positive integer, an instance of size M takes 32 seconds to run. Suppose you run an instance of size 2M and find that it takes 512 seconds to run. What is the value of k?
Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing and combining steps take a time in Θ(n n). Write a recurrence equation for the running time T (n) , and solve the equation for T (n) 2. Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing...