|
|
back to boardPlease, help me to solve this problem! First of all, I sorry for my bad English. Please help me to solve this problem. I wrote solution, but my program works very slow(>0.5). I think that idea of my solution is bad. Please help me! You may use(+) Well my solution isn't the fastest but is quick. Maybe is something complicated, but as you may see the data are ordered like a queue and you want to determine of all the data in the queue which one is the greatest, print it, and then throw the first, add the later and do the operation again. Hint: There's a Data Structure which does exactly this :). Doubts?: miguelangelhdz@hotmail.com Re: You may use(+) Are you referring to a heap? Because that's was the first things that came to my mind (and nothing else so far)... If you are referring to a heap, could you explain how you decide which one to "throw away"? I can't seem to fit the idea of a queue and heap together... |
|
|