Question: An easter algorithm problem Easter is just around the corner, so it's better to start preparing. The Easter Bunny has buried Easter eggs at $n$
An easter algorithm problem
Easter is just around the corner, so it's better to start preparing. The Easter Bunny has buried Easter eggs at $n$ locations $xi yi$ $i n$ Each Easter egg has a taste quality $bi$ that depends on what is put in the Easter egg and can be positive or negative. All Easter eggs we pick up must be eaten, and we want to maximize the sum of $bi$ Since we have limited time, we borrow a digger that can take all Easter eggs in some area bounded by $x y$ ie we get all eggs with coordinates $xi leq x$ $yi leq y$
Argue that the best area to dig up $x y$ can be chosen such that the coordinates $x$ and $y$ are one of the coordinates of the Easter eggs not necessarily of the same egg
We add one function to an AVL tree, T For $k$ we define
$$
textprefixvalksumxkey leq k xval
$$
where the sum is taken over all keys in $T$ We want to find the node $y$ that maximizes prefixval$ykey$ Show how to modify AVL trees to find this node and the prefixval value in $O$ time.
Describe how to use this data grid along with other methods to find the best coordinate to unearth the Easter eggs in $Onlog n$ time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
