The priority queue is implemented as a heap, where all the children for a particular node have a lower priority than the parent, but not necessarily from his siblings.
Elements are stored in an array (I suspect) as follows:
For each node, the children are stored in 2 * pos and 2 * pos + 1. Thus, for [1, 2, 9, 6, 3]:
element 1 (value 1), children are 2 and 9. element 2 (value 2), children are 6 and 3 element 3 (value 9), 4 (value 6) and 5 (value 3) have no children...
When removed from the queue, the parent node is replaced by one of the children with the highest priority, which is again replaced by one of its children, etc. (operation is very optimal, only O (log n) run time) For example:
[1, 2, 9, 6, 3] [2, 9, 6, 3] [3, 9, 6] [6, 9] [6]
The list is very sorted, it is only on the heap, which is not so obvious when printing it as a list.