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 On Mon, Apr 29, 2013 at 11:46 PM, Stanislav Zholnin < stanislav.zhol...@gmail.com> wrote: > Thanks you a lot. > > As usual in my case (and I think it is more or less true for everybody), > analysis of problems I solved seems to be much more complicated than my > solution, while analysis of problems I didn't solve seems to be superficial > and not detailed enough to easily grasp :) Oh, human irrational nature. > > -- > 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 google-code+unsubscr...@googlegroups.com. > To post to this group, send email to google-code@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-code/-/cyqZTw412AEJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.