Each of the following problems can be solved with techniques taught in lecture. Construct a simple...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Each of the following problems can be solved with techniques taught in lecture. Construct a simple directed graph, write an algorithm for each problem by black-boxing algorithms taught in lecture, and analyze its runtime. You do not need to provide proofs of correctness. (a) The CS 170 course staff is helping build a roadway system for PNPenguin's hometown in Antarctica. Since we have skill issues, we are only able to build the system using one-way roads between igloo homes. Before we begin construction, PNPenguin wants to evaluate the reliability of our design. To do this, they want to determine the number of reliable igloos; an igloo is reliable if you are able to leave the igloo along some road and then return to it along a path of other roads. However, PNPenguin isn't very good at algorithms, and they need your help. Given our proposed roadway layout, design an efficient algorithm that determines the number of reliable igloos. (b) There are p different species of Pokemon, all descended from the original Mew. For any species of Pokemon, Professor Juniper knows all of the species directly descended from it. She wants to write a program that answers queries about these Pokemon. The program would have two inputs: a and b, which represent two different species of Pokemon. Her program would then output one of three options in constant time (the time complexity cannot rely on p): (1) a is descended from b. (2) is descended from a. (3) a and b share a common ancestor, but neither are descended from each other. Unfortunately, Professor Juniper's laptop is very old and its SSD drive only has enough space to store up to O(p) pieces of data for the program. Give an algorithm that Professor Juniper's program could use to solve the problem above given the constraints. Hint: Professor Juniper can run some algorithm on her data before all of her queries and store the outputs of the algorithm for her program; time taken for this precomputation is not considered in the query run time. (c) Bob has n different boxes. He wants to send the famous "Blue Roses' Unicorn" figurine from his glass menagerie to his crush. To protect it, he will put it in a sequence of boxes. Each box has a weight w and size s; with advances in technology, some boxes have negative weight. A box a inside a box b cannot be more than 15% smaller than the size of box b; otherwise, the box will move, and the precious figurine will shatter. The figurine needs to be placed in the smallest box x of Bob's box collection. Bob (and Bob's computer) can ask his digital home assistant Falexa to give him a list of all boxes less than 15% smaller than a given box c (i.e. all boxes that have size between 0.85 to 1 times that of c). Bob will need to pay postage for each unit of weight (for negative weights, the post office will pay Bob!). Find an algorithm that will find the lightest sequence of boxes that can fit in each other in linear time (in terms of the graph). Hint: How can we create a graph knowing that no larger box can fit into a smaller box, and what property does this graph have? Each of the following problems can be solved with techniques taught in lecture. Construct a simple directed graph, write an algorithm for each problem by black-boxing algorithms taught in lecture, and analyze its runtime. You do not need to provide proofs of correctness. (a) The CS 170 course staff is helping build a roadway system for PNPenguin's hometown in Antarctica. Since we have skill issues, we are only able to build the system using one-way roads between igloo homes. Before we begin construction, PNPenguin wants to evaluate the reliability of our design. To do this, they want to determine the number of reliable igloos; an igloo is reliable if you are able to leave the igloo along some road and then return to it along a path of other roads. However, PNPenguin isn't very good at algorithms, and they need your help. Given our proposed roadway layout, design an efficient algorithm that determines the number of reliable igloos. (b) There are p different species of Pokemon, all descended from the original Mew. For any species of Pokemon, Professor Juniper knows all of the species directly descended from it. She wants to write a program that answers queries about these Pokemon. The program would have two inputs: a and b, which represent two different species of Pokemon. Her program would then output one of three options in constant time (the time complexity cannot rely on p): (1) a is descended from b. (2) is descended from a. (3) a and b share a common ancestor, but neither are descended from each other. Unfortunately, Professor Juniper's laptop is very old and its SSD drive only has enough space to store up to O(p) pieces of data for the program. Give an algorithm that Professor Juniper's program could use to solve the problem above given the constraints. Hint: Professor Juniper can run some algorithm on her data before all of her queries and store the outputs of the algorithm for her program; time taken for this precomputation is not considered in the query run time. (c) Bob has n different boxes. He wants to send the famous "Blue Roses' Unicorn" figurine from his glass menagerie to his crush. To protect it, he will put it in a sequence of boxes. Each box has a weight w and size s; with advances in technology, some boxes have negative weight. A box a inside a box b cannot be more than 15% smaller than the size of box b; otherwise, the box will move, and the precious figurine will shatter. The figurine needs to be placed in the smallest box x of Bob's box collection. Bob (and Bob's computer) can ask his digital home assistant Falexa to give him a list of all boxes less than 15% smaller than a given box c (i.e. all boxes that have size between 0.85 to 1 times that of c). Bob will need to pay postage for each unit of weight (for negative weights, the post office will pay Bob!). Find an algorithm that will find the lightest sequence of boxes that can fit in each other in linear time (in terms of the graph). Hint: How can we create a graph knowing that no larger box can fit into a smaller box, and what property does this graph have?
Expert Answer:
Answer rating: 100% (QA)
a To solve this problem we can construct a directed graph where each igloo is represented by a node and there is a directed edge from igloo A to igloo B if there is a oneway road from A to B Then we c... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these banking questions
-
Peter O Day , Manager, Technical and Communications needs you to set up a secure communications infrastructure for remote employees that may be working from home or on the road. What can be used to...
-
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...
-
The Chicago Omni Hotel is a 750-room luxury hotel offering guests the finest facilities in downtown Chicago. The hotel is organized into four departments: lodging, dining, catering, and retail...
-
Calculate the reversible work and irreversibility for the process described, assuming that the heat transfer is with the surroundings at20C.
-
According to Anthony Allesandra, which of the following skills should be taught in schools to improve people's ability to listen? .
-
Football and Cognitive Percentile Exercise 2.143 on page 102 introduces a study that examines several variables on collegiate football players, including the variable Years, which is number of years...
-
Acme Corporation (a U.S. company located in Sarasota, Florida) has the following import/export transactions in 2011: March 1 Bought inventory costing 50,000 pesos on credit. May 1 Sold 60 percent of...
-
The graph below is a market demand curve for steaks. $8 A $6 B D C $4 E 0 3 6 Q (Million) a. Clearly label the consumer surplus associated with a market price of $6 using the letters on the graph...
-
The trial balance of Pacilio Security Services Inc. as of January 1, 2017, had the following normal balances: Cash ................. 78 , 972 P e t t y C a s h . . . . . . . . . . . . . . . . 100 A c...
-
A waveguide Ras a square cross section of side 2a. For the TM modes of wave vector K, the transverse em modes are obtained in terms of a function 4(x,y) which obeys the equation: ( + y + (10-1]]...
-
Calculate the characteristic impedance of a long transmission line that its transmission matrix is as follows: \[ [T]=\left[\begin{array}{cc} \frac{1}{2} & j \\ \frac{3}{4} j & \frac{1}{2}...
-
In 2001 , investor Warren Buffett had this to say about pension accounting: Unfortunately, the subject of pension [return] assumptions, critically important though it is, almost never comes up in...
-
In this chapter, you have seen that the voltage of an electrochemical cell is sensitive to the concentrations of the reactants and products in the cell. As a result, electrochemical cells can be used...
-
What is auditing?
-
What does sustainability mean?
-
A sales manager for an advertising agency believes there is a relationship between the number of contacts that a salesperson makes and the amount of sales dollars earned). Compute the regression...
-
Which of the companies has the lowest accounts receivable turnover in the year 20X2? a. Company A. b. Company B. c. Company C. d. CompanyD. 20X1 20X2 Credit Sales Average Receivables Balance $1.0...
-
The United Steelworkers of America and Kaiser Aluminum entered into a master collective bargaining agreement covering terms and conditions of employment at fifteen Kaiser plants. The agreement...
-
Mrs. Embs went into Stampers Cash Market to buy soft drinks for her children. She removed five bottles from an upright soft drink cooler, placed them in a carton, and then turned to move away from...
-
GM Sub Corporation (GM Sub), a subsidiary of Grand Metropolitan Limited, acquired all outstanding shares of Liggett Group, Inc., a Delaware corporation. Rothschild International Corporation...
-
At what height above the surface of Pluto is the acceleration due to gravity half its surface value?
-
How far above Farth's surface must a \(10,000-\mathrm{kg}\) boulder be moved to increase the mass of the Earthboulder system by \(2.50 \mathrm{mg}\) ? Assume the same ratio of energy change to mass...
-
Show that for small displacements the restoring force exerted on part 2 of the displaced string in Figure 15.14 is linearly proportional to the displacement of that part from its equilibrium...
Study smarter with the SolutionInn App