# Path: pyalgs/algorithms/commons/util.py
# def cmp(a, b):
#     if a is None:
#         return -1
#     if b is None:
#         return -1
#     return (a > b) - (a < b)
# 
# Path: pyalgs/data_structures/commons/queue.py
# class Queue(object):
#     """ Queue interface
#     
#     """
# 
#     __metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def enqueue(self, item):
#         pass
# 
#     @abstractmethod
#     def dequeue(self):
#         pass
# 
#     @abstractmethod
#     def is_empty(self):
#         pass
# 
#     @abstractmethod
#     def size(self):
#         pass
# 
#     @staticmethod
#     def create():
#         return LinkedListQueue()
# 
#     @abstractmethod
#     def iterate(self):
#         pass


from abc import ABCMeta
from pyalgs.algorithms.commons.util import cmp
from pyalgs.data_structures.commons.queue import Queue
        else:
            if x.left is None:
                return x.right
            elif x.right is None:
                return x.left
            else:
                m = self.min(x.right)
                m.right = self.del_min(x.right)
                m.left = x.left

                x = m

        x.count = 1 + _count(x.left) + _count(x.right)
        return x

    def min(self, x):
        if x.left is None:
            return x
        return self.min(x.left)

    def del_min(self, x):
        if x.left is None:
            return x.right
        x.left = self.del_min(x.left)
        return x

    def contains_key(self, x):
        return self.get(x) is not None

    def keys(self):

# Path: pyalgs/algorithms/commons/util.py
# def cmp(a, b):
#     if a is None:
#         return -1
#     if b is None:
#         return -1
#     return (a > b) - (a < b)
# 
# Path: pyalgs/data_structures/commons/queue.py
# class Queue(object):
#     """ Queue interface
#     
#     """
# 
#     __metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def enqueue(self, item):
#         pass
# 
#     @abstractmethod
#     def dequeue(self):
#         pass
# 
#     @abstractmethod
#     def is_empty(self):
#         pass
# 
#     @abstractmethod
#     def size(self):
#         pass
# 
#     @staticmethod
#     def create():
#         return LinkedListQueue()
# 
#     @abstractmethod
#     def iterate(self):
#         pass


# Path: pyalgs/data_structures/commons/binary_search_tree.py
from abc import ABCMeta
from pyalgs.algorithms.commons.util import cmp
from pyalgs.data_structures.commons.queue import Queue

        else:
            if x.left is None:
                return x.right
            elif x.right is None:
                return x.left
            else:
                m = self.min(x.right)
                m.right = self.del_min(x.right)
                m.left = x.left

                x = m

        x.count = 1 + _count(x.left) + _count(x.right)
        return x

    def min(self, x):
        if x.left is None:
            return x
        return self.min(x.left)

    def del_min(self, x):
        if x.left is None:
            return x.right
        x.left = self.del_min(x.left)
        return x

    def contains_key(self, x):
        return self.get(x) is not None

    def keys(self):

        queue = Queue.create()