I have the number of priority and priority queues in my application
What specific data type do you use for Queues ? A LinkedList ? In this case, you should get the element n th, returning it to the linked list.
But you should not use Queue
Regarding the priority queue, it seems from your question that you are also not using the correct data structures.
The priority queue always returns the min element (optional).
So what do you mean here element n ? Insertable n or n inserted or what? Therefore, we cannot say what to do in this case.
source share