Can someone explain the binary tree part of the O(NlogN) solution for problem B to me? Why do we need a binary search tree here? The purpose of the tree is to help find the nearest activity or find out the limits? I understand the solution in this way: we need to find the nearest activity that has been considered and find out the limits it imposed. So can we make the activity array into an object array, each array element will contain the limits (how many it needs and how many it will leave unspent) when we find the nearest activity that has been considered.
(We copy the array first and make it into another object array so that each of them contain the original position, then sort it to determine which one we should consider next so we will always consider the highest values unconsidered activity.) Hope I made the question clear -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msg/google-code/-/z3E82ZDlYEkJ. For more options, visit https://groups.google.com/groups/opt_out.
