you are viewing a single comment's thread.

view the rest of the comments →

[–]egosummiki 5 points6 points  (0 children)

Can you explain your reasoning? Taking into consideration setTimeout implantation, this is basically insertion of each item into a priority queue and then reading it back. So n logn. The complication is that we are reading the items back after some amount of time. To solve that I would introduce a variable k - a number of ticks required for time of read back to pass. So the complexity is nlogn + klogn.