For simplicity assume in the following that a multiplication of two integers with d digits costs...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For simplicity assume in the following that a multiplication of two integers with d digits costs O(d²) time, albeit faster algorithms are known. Let n be a given integer with k digits. We wish to compute x = L√n, the integer part of the square root of n. One simple idea is to test for an integer x whether x² < n or x² > n and, depending on the result, to increase or decrease x. In this way we can find the correct x by binary search. We will figure out a time bound for the algorithm sketched above. Note that the input length is the number k of digits, and digit operations are the elementary operations to be counted here. In detail: 1.1. How "long" are the tested numbers x? That is, specify the number of digits in O-notation. (2) 1.2. How many steps of binary search are needed? Express this again as a function of k, in O-notation. (2) 1.3. How many digit operations are needed in each step of binary search? Do not forget that comparisons of numbers cost time as well. (3) 1.4. Finally, put things together to obtain an overall time bound. It should be polynomially bounded in k. (2) 1.5. Discuss: What changes in the time bound if we wish to compute the cubic root x = [n] instead? (3) For simplicity assume in the following that a multiplication of two integers with d digits costs O(d²) time, albeit faster algorithms are known. Let n be a given integer with k digits. We wish to compute x = L√n, the integer part of the square root of n. One simple idea is to test for an integer x whether x² < n or x² > n and, depending on the result, to increase or decrease x. In this way we can find the correct x by binary search. We will figure out a time bound for the algorithm sketched above. Note that the input length is the number k of digits, and digit operations are the elementary operations to be counted here. In detail: 1.1. How "long" are the tested numbers x? That is, specify the number of digits in O-notation. (2) 1.2. How many steps of binary search are needed? Express this again as a function of k, in O-notation. (2) 1.3. How many digit operations are needed in each step of binary search? Do not forget that comparisons of numbers cost time as well. (3) 1.4. Finally, put things together to obtain an overall time bound. It should be polynomially bounded in k. (2) 1.5. Discuss: What changes in the time bound if we wish to compute the cubic root x = [n] instead? (3)
Expert Answer:
Answer rating: 100% (QA)
11 The tested numbers are 2kdigit numbers because the square root of an ndigit number can have up to ... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
A beam AB of span 1 2 m is simply supported at its ends is subjected to a point load of 4 0 kN at C at a distance of 4 m from left end. Using moment area method, Compute thedeflection at the point C...
-
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...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Task 1 You need to produce a report that demonstrates analytical and practical skills and use these to explain the effects of loads on pin-jointed frames, suggesting improvements to the structures....
-
Use a phase diagram like that shown in Fig. 6.36 to indicate how zone leveling may be described.
-
An internal auditor determines that the process is not designed adequately to reduce the underlying risks to an acceptable level. Which of the following should the internal auditor do next? a. Write...
-
Discuss corporate organization and committee structure.
-
Multiple Choice Questions 1. Candy Corp. is a C corporation that began operations in year 1. Candy Corp.'s year 1 through year 3 taxable earnings and profits (E & P) are computed as follows. Year E &...
-
Which type of merchandise have HP company focused on carrying? Who are target customers? What relationships do these products have with their target customers? What is breadth and depth of...
-
Problem 3 addressed the cross-sectional variation in the number of financial analysts who follow a company. In that problem, company size and debt-to-equity ratios were the independent variables. You...
-
Process costing should be used to assign costs to products when the: a. units produced are similar b. units produced are dissimilar c. calculation of unit costs requires the averaging of the unit...
-
draw a detailed design OS a software by using persistent layer or web application or state machine diagram
-
A design decision in OS management is how to minimize the number of fault page faults. Briefly describe two ways to do it?
-
Question 4 (1 point) You graduate and decide to start a new business with some of your classmates. The product your business makes is an App for students to take notes on ipad, which is called...
-
(a) State exactly what property the string input by the user must have for the program below to print "Yes..." Explain the program logic concisely but clearly (i.e. give the key steps). (2 marks) int...
-
2. Sorting data is an important task that many data storage systems use. This problem will be based on the bubble sort. The bubble sort will compare adjacent entries and swap them if the entries are...
-
Think about an organization you are familiar with that uses both human relations and human resources principles in its management and communication practices. Describe these practices and discuss the...
-
Data 9.2 on page 540 introduces the dataset Cereal, which includes information on the number of grams of fiber in a serving for 30 different breakfast cereals. The cereals come from three different...
-
We define the Josephus problem as follows. Suppose that n people form a circle and that we are given a positive integer m n. Beginning with a designated first person, we proceed around the circle,...
-
Prove that if p is prime and 0 < k < p, then gcd(k, p) = 1.
-
What is the running time of HEAPSORT on an array A of length n that is already sorted in increasing order? What about decreasing order?
-
A light ray travels from medium l to medium 3 as shown. For these media, A. nz > n 13 B. n3 = n nz C. n3
-
A Jens produces a sharply focused, inverted image on a screen. What will you see on the screen if the lens is removed? A. The image will be inverted and blurry. B. The image will be upright and...
-
An object and lens are positioned to form a well-focused, inverted image on a viewing screen. Then a piece of cardboard is lowered just in front of the lens to cover the top half of the lens. Using...
Study smarter with the SolutionInn App