In python, it is possible to transform a list into a priority queue where the top element is the element with the highest priority (and the highest value (in the case of a list of integers)).
heapq — Heap queue algorithm in python helps transform a list into a priority queue.
heapq.heapify(x)
// Transform list x into a heap, in-place, in linear time.
Example:
Example
Input: [ 3, [4, 5, 6], [5, 7, 2] ]
Output: [4, 5, 5]
Explanation: (k=3)