# Path: pyalgs/algorithms/commons/util.py
# def less(a, b):
#     return cmp(a, b) < 0
# 
# def exchange(a, i, j):
#     tmp = a[j]
#     a[j] = a[i]
#     a[i] = tmp
# 
# def greater(a, b):
#     return cmp(a, b) > 0


from pyalgs.algorithms.commons.util import less, exchange, greater
        while k > 1:
            parent = k // 2
            if less(self.keys[self.pq[k]], self.keys[self.pq[parent]]):
                exchange(self.pq, k, parent)
                self.qp[self.pq[k]] = k
                self.qp[self.pq[parent]] = parent
                k = parent
            else:
                break

    def get(self, index):
        return self.keys[index]

    def min_key(self):
        return self.keys[self.pq[1]]

    def del_min(self):
        index = self.pq[1]
        exchange(self.pq, 1, self.N)
        self.qp[self.pq[1]] = 1
        self.qp[self.pq[self.N]] = self.N

        self.N -= 1
        self.sink(1)

        return index

    def sink(self, k):
        while 2 * k <= self.N:
            child = 2 * k

# Path: pyalgs/algorithms/commons/util.py
# def less(a, b):
#     return cmp(a, b) < 0
# 
# def exchange(a, i, j):
#     tmp = a[j]
#     a[j] = a[i]
#     a[i] = tmp
# 
# def greater(a, b):
#     return cmp(a, b) > 0


# Path: pyalgs/data_structures/commons/priority_queue.py
from pyalgs.algorithms.commons.util import less, exchange, greater

        while k > 1:
            parent = k // 2
            if less(self.keys[self.pq[k]], self.keys[self.pq[parent]]):
                exchange(self.pq, k, parent)
                self.qp[self.pq[k]] = k
                self.qp[self.pq[parent]] = parent
                k = parent
            else:
                break

    def get(self, index):
        return self.keys[index]

    def min_key(self):
        return self.keys[self.pq[1]]

    def del_min(self):
        index = self.pq[1]
        exchange(self.pq, 1, self.N)
        self.qp[self.pq[1]] = 1
        self.qp[self.pq[self.N]] = self.N

        self.N -= 1
        self.sink(1)

        return index

    def sink(self, k):
        while 2 * k <= self.N:
            child = 2 * k

            if child < self.N and less(self.keys[self.pq[child]], self.keys[self.pq[child+1]]):