The following algorithm determines whether a given natural number N is prime: for each integer k...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The following algorithm determines whether a given natural number N is prime: for each integer k from 2 to [√n] do if k | N then return "N is not prime" end if end for return "N is prime" (a) Suppose that checking whether k | N takes time O (log² (N)) time. What is the running time of this algorithm, as a function of N? You do not need to give a proof. (b) Suppose N is given in binary. What is the running time of the algorithm, as a function of the input size? (Hint: The input is simply N in binary, so the input size is just the length of the binary representation of N.) (c) Is this algorithm efficient? Does it run in polynomial time? The following algorithm determines whether a given natural number N is prime: for each integer k from 2 to [√n] do if k | N then return "N is not prime" end if end for return "N is prime" (a) Suppose that checking whether k | N takes time O (log² (N)) time. What is the running time of this algorithm, as a function of N? You do not need to give a proof. (b) Suppose N is given in binary. What is the running time of the algorithm, as a function of the input size? (Hint: The input is simply N in binary, so the input size is just the length of the binary representation of N.) (c) Is this algorithm efficient? Does it run in polynomial time? The following algorithm determines whether a given natural number N is prime: for each integer k from 2 to [√n] do if k | N then return "N is not prime" end if end for return "N is prime" (a) Suppose that checking whether k | N takes time O (log² (N)) time. What is the running time of this algorithm, as a function of N? You do not need to give a proof. (b) Suppose N is given in binary. What is the running time of the algorithm, as a function of the input size? (Hint: The input is simply N in binary, so the input size is just the length of the binary representation of N.) (c) Is this algorithm efficient? Does it run in polynomial time?
Expert Answer:
Answer rating: 100% (QA)
a The running time of the algorithm as a function of N can be expressed as ON log2N This is becau... View the full answer
Related Book For
Introduction to Management Science A Modeling and Cases Studies Approach with Spreadsheets
ISBN: 978-0078024061
5th edition
Authors: Frederick S. Hillier, Mark S. Hillier
Posted Date:
Students also viewed these programming questions
-
NPV Analysis of a New Product XYZ Electronics has just developed a new electronic device for automobiles that will verify how many miles the car is being driven and how safely the driver is driving....
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
What is the difference between a market system and a market? How Can you have a market without a market system? Why or why not? How about the other way around? Can you have a market system without a...
-
Write the triple iterated integrals for the volume of a sphere of radius a in each case. (a) Cartesian coordinates (b) Cylindrical coordinates (c) Spherical coordinates
-
Joey Moss, a recent finance graduate, has just begun his job with the investment firm of Covili and Wyatt. Paul Covili, one of the firm's founders, has been talking to Joey about the firm's...
-
On January 2, 2015, Winstead & Company purchased 1,000,000 shares of the Secrest Company for \($32\) million. The investment represented 40 percent of the outstanding common shares of The Secrest...
-
1. Draw a diagram of the drop process. How long should it take to empty 300 silver dollar slot machines? 2. Draw a diagram of the hard count process. How long should this process take to complete for...
-
The Rocky Mountain district sales manager of Rath Publishing Incorporated, a college textbook publishing company, claims that the sales representatives make an average of 38 sales calls per week on...
-
Compute and interpret financial ratios that managers use to assess liquidity. Compute and interpret financial ratios that managers use for asset management purposes. Compute and interpret financial...
-
When extracting data using data types, which symbol displays for an unidentified item? # ? &
-
Joe runs up the stadium steps as an athletic drill. There are 50 steps and each one is 0.30 meters high and 0.50 meters deep. If Joe has a mass of 95 kg and runs the steps in 30 seconds, how much...
-
What do you think of the accuracy of your perceptions of the average "typical" American diet? Any surprises?Use this website "https://insteading.com/blog/food-consumption-in-america/" Do you agree...
-
The construction of a new coal mine will cost Yamada Co. Ltd. $430,000, with the expenditure occurring the next year. The investment will bring about cash flows of $200,000 annually over the...
-
Discuss how you would engage various stakeholders within the school community (e.g., parents, teachers, students, administrators).
-
what ways does hazard analysis play a role in the design and implementation of safety instrumented systems (SIS), particularly in determining Safety Integrity Levels (SILs) and developing safety...
-
A stock's return has the following distribution: Demand for the Company's Products Probability of This Demand Occurring Rate of Return if This Demand Occurs (%) Weak 0.1 -35 % Below average 0.2 -6...
-
For the following arrangements, discuss whether they are 'in substance' lease transactions, and thus fall under the ambit of IAS 17.
-
Reconsider Problem 9.4. Warren Buffy decides that Bayes' decision rule is his most reliable decision criterion. He believes that 0.1 is just about right as the prior probability of an improving...
-
Weenies and Buns is a food processing plant that manufactures hot dogs and hot dog buns. They grind their own flour for the hot dog buns at a maximum rate of 200 pounds per week. Each hot dog bun...
-
Read the referenced article that fully describes the management science study summarized in the application vignette presented in Section 6.1. Briefly describe how the model for a special type of...
-
Why do firms advertise?
-
Is advertising good or bad from societys perspective?
-
Why is it so important for monopolistically competitive firms to advertise?
Study smarter with the SolutionInn App