Problem 6. Professor I. M. Nuts of the Math Department is scratching his head over the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 6. Professor I. M. Nuts of the Math Department is scratching his head over the following problem. Given two sequences of numbers X (x1,...,xn) and Y = (y₁,..., yn) he must find the m≤ √n largest values of the sums xi + Yj, 1 ≤ i, j≤n in SORTED ORDER (smallest to largest). One may assume that m≤ √√n but one must not assume that m is a constant. The proposed algorithm should have worst-case running time that is o(n²). He requests the assistance of the CS Department in dealing with this problem. (a) Give an algorithm whose worst-case running time is o(n²) that solves this problem; an (n²2) time algorithm will not get you any points. (b) Does there exist an algorithm whose worst-case performance is O(n) ? Explain, i.e. show/prove that such an algorithm does not exist or give the algorithm and analyze its performance, if such an algorithm exists. Example. If X = (2,0, -2, -3, 1, 100, 290, 300, 4) and Y (-20, -19,-8, -200, 11, 1, 10, -7,0) and m = 3 then the answer is (301, 310, 311). Note that 301 can result either as the sum of 290 + 11 or 300 + 1. = - Problem 6. Professor I. M. Nuts of the Math Department is scratching his head over the following problem. Given two sequences of numbers X (x1,...,xn) and Y = (y₁,..., yn) he must find the m≤ √n largest values of the sums xi + Yj, 1 ≤ i, j≤n in SORTED ORDER (smallest to largest). One may assume that m≤ √√n but one must not assume that m is a constant. The proposed algorithm should have worst-case running time that is o(n²). He requests the assistance of the CS Department in dealing with this problem. (a) Give an algorithm whose worst-case running time is o(n²) that solves this problem; an (n²2) time algorithm will not get you any points. (b) Does there exist an algorithm whose worst-case performance is O(n) ? Explain, i.e. show/prove that such an algorithm does not exist or give the algorithm and analyze its performance, if such an algorithm exists. Example. If X = (2,0, -2, -3, 1, 100, 290, 300, 4) and Y (-20, -19,-8, -200, 11, 1, 10, -7,0) and m = 3 then the answer is (301, 310, 311). Note that 301 can result either as the sum of 290 + 11 or 300 + 1. = -
Expert Answer:
Answer rating: 100% (QA)
a Algorithm 1 Initialize a twodimensional array Anm where n is the size of both X and Y and m is the ... View the full answer
Related Book For
Posted Date:
Students also viewed these databases questions
-
A chemist is calibrating a spectrophotometer that will be used to measure the concentration of carbon monoxide (CO) in atmospheric samples. To check the calibration, samples of known concentration...
-
The accounts that will be used by Zant Moving Company follow. Prepare a chart of accounts for the firm. Classify the accounts by type, arrange them in an appropriate order, and assign suitable...
-
The accounts that will be used by Dad & Sons Moving Company follow. Prepare a chart of accounts for the firm. Classify the accounts by type, arrange them in an appropriate order, and assign suitable...
-
EVE, Inc. reported a return on investment of 20%, a sales margin of 25%, and residual income of $480,000. The required rate of return on invested capital is 8%. On the basis of this information, the...
-
Researchers randomly assigned participants either a tall, thin "highball" glass or a short, wide "tumbler," each of which held 355 ml. Participants were asked to pour a shot (1.5 oz = 44.3 ml) into...
-
A cylinder is formed by bolting two semi cylindrical channels together on the inside, as shown in Fig. P8.46. There are 10 bolts per meter of width on each side, and the inside pressure is 50 kPa...
-
Compare open cycle and closed cycle gas turbines.
-
A certain industrial firm desires an economic analysis to determine which of two different machines should be purchased. Each machine is capable of performing the same task in a given amount of time....
-
If you were asked to justify the study of leadership, how would you do it? What is your leadership style? What do you see as your personal strengths and limitations when it comes to your leadership...
-
You are about to open your first restaurant. You restaurant will have 125 seats and will be open 5 nights a week. Projected covers per week will average 1200 and you are open 50 weeks out of the...
-
In your own words, describe the four social responsibility models and the roles of each. Share one example of a company displaying the complete social responsibility spectrum successfully. Why do you...
-
Sarah and Kate are meeting their bank manager Lynn Harvey next month. She has asked them to bring a Cash Budget showing planned receipts and payments for the next six months. Using the following...
-
A particular stock-keeping unit (SKU) has demand that averages 14 units per year and is Poisson distributed. That is, the time between demands is exponentially distributed with a mean of 1/14 years....
-
17-25. Double integrals Evaluate each double integral over the region R by converting it to an iterated integral. 17. [ (x (x + 2y) dA; R = {(x,y): 0x 3,1 y 4} 18. [] (x + xy) dA; R = {(x,y): 1 x...
-
Create a Crow's Foot ER diagram for each business rule. The diagrams should clearly describe and identify each entity and show relationships. Show all cardinality, primary keys, and foreign keys. Use...
-
Consider the basic Solow model that we covered in class where population (labor) grows at a constant and exogenous rate, n > 0, with N+1 (1+n) N. Moreover, the aggregate production function is of the...
-
you completed a simple audit data analytic. Based on what you performed, document how you would plan, perform, and evaluate your analytic ?
-
The May 2014 revenue and cost information for Houston Outfitters, Inc. follow: Sales Revenue (at standard).............. $ 540,000 Cost of Goods Sold (at standard) ..........341,000 Direct Materials...
-
Refer to Exercise 2 in Section 8.2. a. Using each of the three models in turn, predict the NOx emission when Speed = 1500, Torque = 400, and HP = 150. b. Using each of the three models in turn,...
-
The article "Effect of Granular Subbase Thickness on Airfield Pavement Structural Response" (K. Gopalakrishnan and M. Thompson, Journal of Materials in Civil Engineering, 2008:331-342) presents a...
-
A statistics instructor who teaches a lecture section of 160 students wants to determine whether students have more difficulty with one-tailed hypothesis tests or with two-tailed hypothesis tests. On...
-
A university is deciding between two meal plans. One plan charges a fixed fee of \($600\) per semester and allows students to eat as much as they want. The other plan charges a fee based on the...
-
Evaluate this statement: You are a natural athlete, an attractive person who learns easily and communicates well. Clearly, you can do everything better than your friends and acquaintances. As a...
-
In elementary school and through middle school, most students have the same teacher throughout the day and for the entire school year. Then, beginning in high school, different subjects are taught by...
Study smarter with the SolutionInn App