# Path: pyalgs/algorithms/commons/util.py
# def less(a, b):
# def greater(a, b):
# def cmp(a, b):
# def exchange(a, i, j):
# def is_sorted(a):
# 
# 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, abstractmethod
from pyalgs.algorithms.commons import util
from pyalgs.data_structures.commons.queue import Queue
        if x is None:
            x = TSTNode(c)
        compared = util.cmp(c, x.key)
        if compared < 0:
            x.left = self._put(x.left, key, value, d)
        elif compared > 0:
            x.right = self._put(x.right, key, value, d)
        elif len(key)-1 == d:
            if x.value is None:
                self.N += 1
            x.value = value
        else:
            x.mid = self._put(x.mid, key, value, d+1)

        return x

    def delete(self, key):
        x = self._get(self.root, key, 0)
        if x is not None:
            if x.value is not None:
                self.N -= 1
            x.value = None

    def is_empty(self):
        return self.N == 0

    def keys_with_prefix(self, prefix):
        x = self._get(self.root, prefix, 0)
        if x is None:
            return None

# Path: pyalgs/algorithms/commons/util.py
# def less(a, b):
# def greater(a, b):
# def cmp(a, b):
# def exchange(a, i, j):
# def is_sorted(a):
# 
# 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/strings/search_tries.py
from abc import ABCMeta, abstractmethod
from pyalgs.algorithms.commons import util
from pyalgs.data_structures.commons.queue import Queue

        if x is None:
            x = TSTNode(c)
        compared = util.cmp(c, x.key)
        if compared < 0:
            x.left = self._put(x.left, key, value, d)
        elif compared > 0:
            x.right = self._put(x.right, key, value, d)
        elif len(key)-1 == d:
            if x.value is None:
                self.N += 1
            x.value = value
        else:
            x.mid = self._put(x.mid, key, value, d+1)

        return x

    def delete(self, key):
        x = self._get(self.root, key, 0)
        if x is not None:
            if x.value is not None:
                self.N -= 1
            x.value = None

    def is_empty(self):
        return self.N == 0

    def keys_with_prefix(self, prefix):
        x = self._get(self.root, prefix, 0)
        if x is None:
            return None

        queue = Queue.create()