Problem 4. A brickin' awesome problem (2+8+2+3= 15 points) Drew's dad collects bricks.. The bricks are...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 4. A brickin' awesome problem (2+8+2+3= 15 points) Drew's dad collects bricks.. The bricks are laid out in a nx n display, meaning there are n bricks in total (note that you can visualize this as n rows and n columns). Each brick has an age, which is simply the number of years it has been since the brick was produced. You can think of the input as being a nxn matrix B, where B[i, j] is the age of the brick in position i, j. You have been tasked with finding a brick such that none of the bricks adjacent to it (above, below, left, or right) are older than that brick. It is certainly possible that more than one brick meets this condition, in which case, finding any single brick with this property would suffice. If a brick is on a corner or a side, it only needs to be older than all of the adjacent bricks. You are able to access the age of any single brick in O(1) time. Design a O(n)-time divide-and-conquer algorithm to solve this problem. (a) Note that there must be a brick with the desired property. That is, a solution exists. Let L be the largest value of any brick and let (x,y) be any brick such that B[x, y] = L. Argue that (x,y) is a brick with the desired property. Can there be a different brick (u, v) with the desired property such that B[u, v] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 10 4 4 2 4 4 20 20 20 20 20 10 1 4 1 121 10 10 10 10 10 5 10 10 10 11 10 20 20 20 20 20 10 20 20 20 11 20 1 1 1 20 10 20 1 1 1 1 1 1 1 1 20 10 20 1 1 1 1 1 1 1 1 1 1 1 1 20 10 7 6 1 4 1 20 10 6 5 2 4 4 20 10 1 3 1 2 1 1 1 1 20 10 20 1 1 1 1 20 10 20 1 1 1 1 Problem 4. A brickin' awesome problem (2+8+2+3= 15 points) Drew's dad collects bricks.. The bricks are laid out in a nx n display, meaning there are n bricks in total (note that you can visualize this as n rows and n columns). Each brick has an age, which is simply the number of years it has been since the brick was produced. You can think of the input as being a nxn matrix B, where B[i, j] is the age of the brick in position i, j. You have been tasked with finding a brick such that none of the bricks adjacent to it (above, below, left, or right) are older than that brick. It is certainly possible that more than one brick meets this condition, in which case, finding any single brick with this property would suffice. If a brick is on a corner or a side, it only needs to be older than all of the adjacent bricks. You are able to access the age of any single brick in O(1) time. Design a O(n)-time divide-and-conquer algorithm to solve this problem. (a) Note that there must be a brick with the desired property. That is, a solution exists. Let L be the largest value of any brick and let (x,y) be any brick such that B[x, y] = L. Argue that (x,y) is a brick with the desired property. Can there be a different brick (u, v) with the desired property such that B[u, v] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 10 4 4 2 4 4 20 20 20 20 20 10 1 4 1 121 10 10 10 10 10 5 10 10 10 11 10 20 20 20 20 20 10 20 20 20 11 20 1 1 1 20 10 20 1 1 1 1 1 1 1 1 20 10 20 1 1 1 1 1 1 1 1 1 1 1 1 20 10 7 6 1 4 1 20 10 6 5 2 4 4 20 10 1 3 1 2 1 1 1 1 20 10 20 1 1 1 1 20 10 20 1 1 1 1
Expert Answer:
Answer rating: 100% (QA)
a To argue that x y is a brick with the desired property we can observe that if Bx y is the largest value L then it means there are no bricks with a h... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What are the functions of account for the greatest share of federal, state, and local government expenditures? Does the pattern differ much among states?
-
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...
-
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...
-
Let (x) = x - 3, g(x) = x, h(x) = x 3 , and j(x) = 2x. Express each of the functions as a composite involving one or more of , g, h, and j. a. y = x - 3 b. y = 2x c. y = x 1/4 d. y = 4x e. y = (x -...
-
A particle with electric charge q moves along a straight line in a uniform electric field E with a speed of u. The electric force exerted on the charge is qE. The motion and the electric field are...
-
Starting at A, an ideal gas undergoes a cyclic process involving expansion and compression at constant temperature, as shown here. Calculate the total work done. Does your result support the notion...
-
What is the most valuable commodity from a trending program that must be communicated to management of a given facility?
-
You are the chief financial officer for RAM Solutions, a small but rapidly growing retail computer hardware chain. You are trying to figure out how to finance the new buildings that are scheduled to...
-
For the bussines environtment stand point of GE SEC 10 k explain the following, When it comes to risks, what issues might your company face? To find out, search your company's PDF version of the SEC...
-
The Freemont Automobile Factory has discovered that the longer a worker has been on the job, the more parts the worker can produce. Write an application that computes and displays a workers...
-
Consider the following model. A(0) = 10, A(1) = 11.5, S(0) = 35, and S(1) has the following distribution 25, with probability p with probability P2 with probability P3, 30, 45, where p and P2 and p3...
-
UDF is trying to forecast Toilet Paper sales. They have data on the multi-packs from previous years that they want to use to try to figure out what sales will be this year. In 2020 they sold 15,000,...
-
What made Cesar Chavez and Dolores Huerta effective leaders and what was the plight of women of the movement? Who were the first to strike and what was the NFWA? In what ways was the Farmworker...
-
Consider the following $1,000 par value zero-coupon bonds: 12345 BABCDE Bond Years to Maturity Yield to Maturity 5.80 % 7.30 % 7.80 % 8.30 % 10.25 % The expected 1-year interest rate 3 years from now...
-
In the context of global interconnectedness, how do effective leaders navigate cultural nuances and diverse perspectives to foster inclusivity and harness the collective potential of multicultural...
-
Mullineaux Corporation has a target capital structure of 65 percent common stock, 5 percent preferred stock, and 30 percent debt. Its cost of equity is 12 percent, the cost of preferred stock is 4...
-
- A particle of mass m is placed on an inclined plane making an adjustable angle & with horizontal as shown in figure. The coefficient of friction b/w the particle and the inclined plane is . If the...
-
CRUZ, INC. Comparative Balance Sheets December 31, 2015 CRUZ, INC. Income Statement For Year Ended December 31, 2015 Required Use the indirect method to prepare the cash provided or used from...
-
Skyler is covered by his company's health insurance plan. The health insurance costs his company $3,500 a year. During the year, Skyler is diagnosed with a serious illness and the health insurance...
-
Ulysses and Penelope are married and file separate returns for 2012. Penelope itemizes her deductions on her return. Ulysses' adjusted gross income was $17,400, his itemized deductions were $2,250,...
-
Leslie and Leon Lazo are married and file a joint return for 2012. Leslie's Social Security number is 466-47-3311 and Leon's is 467-74-4451. They live at 143 Snapdragon Drive, Reno, NV 82102. For...
-
How the duration of a sprint can be decided?
-
Variants and exception handlers are alternate flows for a use case. In which situations should one or the other be used?
-
Why estimating software development effort is so difficult? What are the obstacles?
Study smarter with the SolutionInn App