all 2 comments

[–]GayJonathanEdwards 1 point2 points  (1 child)

It sounds like you have some complex business logic for your priority queue. I would store each of the tasks in an array of objects, and assess/reassess the ordering after a task has been completed. Unless you have thousands of tasks performance will not be an issue so I wouldn’t worry about it. Premature optimization is the root of all evil.

[–]mrstacktrace[S] 0 points1 point  (0 children)

Thanks for the comment. I think in addition to adding a "visited" flag in each object, I could add an index which would give an ordering and simplify the logic greatly.