subject
Mathematics, 11.02.2020 21:50 animexcartoons209

You are given an n n matrix A with unknown values and your goal is to find an entry that is a local maximum with the smallest number of queries to individual entries. An entry Ai;j is a local maximum if it is not smaller than any of its neighbors (top, bottom, left or right if they exist) i. e. A(i, j) = max{ A(i, j), A(i-1,j), A(i, j-1), A(i+1,j), A(i, j+1)}. You only need to find a local maximum, not the global maximum. Note that there may be multiple local maxima.
1. Design an algorithm to find a local maximum in O(n) number of queries. (Hint: Start by thinking about a strategy for the 1D array first, and then extend it to the 2D setting.)
2. Prove the correctness of your algorithm.
3. Analyze the time complexity of your algorithm by finding a recurrence for the number of queries and solving it.

ansver
Answers: 2

Another question on Mathematics

question
Mathematics, 21.06.2019 21:10
Patty made a name tag in the shape of a parallelogram. reilly made a rectangular name tag with the same base and height. explain how the areas of the name tags compare.
Answers: 2
question
Mathematics, 21.06.2019 22:00
Melanie is buying a bathing suit that costs 39.99. she is given a discount at the cash register of $6.00 when she scratched 15% off on a game piece for a store promotion. what will the sale price of melanie’s bathing suit be?
Answers: 1
question
Mathematics, 22.06.2019 01:30
What is the surface area of the sphere?
Answers: 1
question
Mathematics, 22.06.2019 02:30
Robert has 78 tomatoes and 56 cucumbers he wants to plant them in equal rows how many in each row
Answers: 1
You know the right answer?
You are given an n n matrix A with unknown values and your goal is to find an entry that is a local...
Questions
Questions on the website: 13722362