2

First assignment of the algorithms, data structures and computability module Im doing for my degree.

Priority queues can all eat a bowl of dicks.

It’s just an insert method, I can insert a node into an empty queue, I can insert a new node at the start of the queue.

But trying to insert a node into a specific place in the queue is making my brain hurt.

Comments
  • 1
    There are many aproaches to this. It kinda depends on your data model and performance/memory requirements.

    I'm no student (never was) but if the queue is a linked list it's super easy.

    If your priorities work with weights (or sequence numbers) there is quite some reweighing to do.
  • 1
    @hjk101 thanks.

    I had a break from the assignment for a couple of days, went back to it this morning and cracked it in half an hour.
  • 0
    because that is not the purpose of a queue, is like if you say is a headache to code HTML on java, yes you can do it but is not meant for that purpose
  • 0
    @arcioneo that’s something that would need to be taken up with the university.
Add Comment