what are the invariants of the priority queue? I'm very confused how this code works