# 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

def char_at(key, d):
    return ord(key[d])


class RwayNode(object):
    nodes = None
    value = None
    R = 256

    def __init__(self):
        self.nodes = [None] * RwayNode.R


class RWaySearchTries(SearchTries):

    root = None
    N = 0

    def contains_key(self, key):
        x = self._get(self.root, key, 0)
        if x is None:
            return None
        return x.value

    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


def char_at(key, d):
    return ord(key[d])


class RwayNode(object):
    nodes = None
    value = None
    R = 256

    def __init__(self):
        self.nodes = [None] * RwayNode.R


class RWaySearchTries(SearchTries):

    root = None
    N = 0

    def contains_key(self, key):
        x = self._get(self.root, key, 0)
        if x is None:
            return None
        return x.value

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


        queue = Queue.create()