user512853
user512853

Reputation: 123

Simple priority queue in Java

can anyone tell me an easy way to implement a priority queue that only offers extract_min, add, and reduce key without using the build-in one in Java. It is better to be as efficient as possible and not hard to implement. Please give me a sample. Thank you in advance!

Upvotes: 0

Views: 940

Answers (1)

mih
mih

Reputation: 525

It's rather conceptual problem than implementational one, so I suggest you to have a look at wiki Priority queue or heap pages or dive into some really great books, for instance "Introduction to algorithms". When you understand logic behind those data structures (and other algorithms as well) implementing them in any programming language shouldn't be a big deal.

Upvotes: 4

Related Questions