I need to implement a priority queue where the priority of an item in the queue can change and the queue adjusts itself so that items are always removed in the correct order
I am looking for just exactly the same thing!
And here is some of my idea:
And choose from the following STL sort algorithms: a. partition b. stable_partition c. nth_element d. partial_sort e. partial_sort_copy f. sort g. stable_sort
partition, stable_partition and nth_element are linear-time sort algorithms, which should be our 1st choices.
BUT, it seems that there is no those algorithms provided in the official Java library. As a result, I will suggest you to use java.util.Collections.max/min to do what you want.