Question

In: Computer Science

I didn't answer for the prevuise question A program takes time proportional to the log of...

I didn't answer for the prevuise question

  1. A program takes time proportional to the log of the input size. If the program takes 100ms for input size 1,000, how many milliseconds does it take for input size 1,000,000?
  1. A program takes time proportional to the square root of the input size. If the program takes 100 ms for input size 500, how many milliseconds does it take for input size 2,000?

  1. A program takes time proportional to the cube of the input size. The first run, with a given input size s, takes 10 ms. The second run is with input size 3s.  How many milliseconds does the program take this time?  (Type in just the number; don't type "ms" at the end.)  

  1. Suppose the runtime of a compute program is proportional to n4 where n is the input size. If the original runtime is 11 for input size 1000, what is the new runtime for input size 3000?
  1. Supppose program takes time proportional to n2 where n is the input size. If the program takes 2 milliseconds for input size 10, how many milliseconds does it take for input size 20 ?

Solutions

Expert Solution

1. A program takes time proportional to the log of the input size i.e. T(n) = Order (log(n))

given T(n) = 100 ms for 1000 i.e    100 = O(log(1000))

for 1,000,000 which is 10002 we get   T(n) = O(log(10002)) =O(2* log(1000)) =2* O(log(1000)) =200

2. A program takes time proportional to the square root of the input size. i.e. T(n) = Order( n0.5 )

given for O((500)0.5) output = 100 , for 2000 =500*4 we get output = O((500 *4)0.5) =2* O((500)0.5) =2 * 100 =200

3. A program takes time proportional to the cube of the input size T(n) =Order(n3)

given for s output is 10   so for 3s we get O(n3) =O((3s)3) = O(9s3)= 9*10 =90

4. the runtime of a compute program is proportional to n4 where n is the input size

for input 1000 output is 11 ie O(10004) = 11

for O(30004) we get 34 *O(10004) =81*11 =891

5. program takes time proportional to n2 where n is the input size

for input 10 output is 2 applying similar procedure output for 20 = 22* O(102) = 4*2 = 8


Related Solutions

I'm sorry I didn't post the question in details ,this is the full question , Using...
I'm sorry I didn't post the question in details ,this is the full question , Using the acronym, A.C.T.I.O.N identify and explain the sequence of the tool recommends you follow to address all medication problems 2) Give a brief description of the focus in each section, Situation : Your client is 84 and has rheumatoid arthritis, Each week the RN distributes her medication for each day in a diverted. Today your client's joints seem very inflamed and she asks you...
Question 1 a). i. To estimate the average time it takes to assemble a certain printer...
Question 1 a). i. To estimate the average time it takes to assemble a certain printer component, the industrial engineer at an electronics firm timed 40 technicians in the performance of this task, getting a mean of 12.73 minutes and a standard deviation of 2.06 minutes. Construct a 98% confidence interval for the true average time it takes to assemble the printer component. ii. A sample of 16 girls gave a mean mass of 35 kg and a standard deviation...
Question 1 a). i. To estimate the average time it takes to assemble a certain printer...
Question 1 a). i. To estimate the average time it takes to assemble a certain printer component, the industrial engineer at an electronics firm timed 40 technicians in the performance of this task, getting a mean of 12.73 minutes and a standard deviation of 2.06 minutes. Construct a 98% confidence interval for the true average time it takes to assemble the printer component. ii. A sample of 16 girls gave a mean mass of 35 kg and a standard dev...
Write a program that takes two command line arguments at the time the program is executed....
Write a program that takes two command line arguments at the time the program is executed. You may assume the user enters only decimal numeric characters. The input must be fully qualified, and the user should be notified of any value out of range for a 23-bit unsigned integer. The first argument is to be considered a data field. This data field is to be is operated upon by a mask defined by the second argument. The program should display...
I want a case study with question and answer of this topic : time value of...
I want a case study with question and answer of this topic : time value of money that include present value and future value also annuity and compound.
The time it takes for a computer program to compile can be modeled with a Gamma...
The time it takes for a computer program to compile can be modeled with a Gamma distribution with a mean of 1 minute and a variance of 0.5 minutes^2. Find the probability that it takes more than 1 minute for a program to compile.
I need someone to create a program for me: Create a program that takes as input...
I need someone to create a program for me: Create a program that takes as input an employee's salary and a rating of the employee's performance and computes the raise for the employee. The performance rating here is being entered as a String — the three possible ratings are "Outstanding", "Acceptable", and " Needs Improvement ". An employee who is rated outstanding will receive a 10.2 % raise, one rated acceptable will receive a 7 % raise, and one rated...
THIS IS THE SECOND TIME I AM UPLOADING THIS QUESTION - PLEASE READ THE REQUIREMENT! ANSWER...
THIS IS THE SECOND TIME I AM UPLOADING THIS QUESTION - PLEASE READ THE REQUIREMENT! ANSWER IN 150 WORDS OR LESS! Section 1 (3 marks: You can start this section after Week 4 lecture) Read the following article: Harford, T. (2014), ‘Big data: A big mistake?’, Significance 11(5), 14–19. Question: Critically evaluate the main points of the article using three bullet points, in less than 150 words in total. Critical evaluation means To give your opinion on something To support...
I got a little problem when i was trying to write a program that takes a...
I got a little problem when i was trying to write a program that takes a hexadecimal number and convert it to a binary number. It just don't give me the right answer. Here's my code: #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> int main(int argc, char *argv[]) { unsigned long int i; i=0xffff; char buffer[65]; sprintf(buffer, "%lud", i); long int x = 0; while (buffer[x]) {    switch (buffer[x]) { case '0': printf("0000"); break; case '1': printf("0001"); break;...
Write a program, using your favourite programming language, to parse time log files to report how...
Write a program, using your favourite programming language, to parse time log files to report how much time in total spent on project. The time log file TimeLogCarbon.txt. Time Log: 2/23/12: 9:10pm - 11:40pm getting familiar with Flash 2/29/12: 12:50pm - 2:00pm getting familiar with Flash 3/1/12: 6:00pm - 11:40pm getting familiar with Flash 3/3/12: 3:00pm - 7:00pm step-debug Energy Game code 3/4/12: 8:00pm - 11:40pm start carbon game 3/5/12: 2:00pm - 3:00pm, 4:00pm - 4:30pm carbon game 3/6/12: 11:30am...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT