@Override
    public void put(String key, Value value) {

        char[] array = key.toCharArray();
        Node node = this.root;

        for (char ch : array) {
            int childIndex = this.keyMap.get(ch);
            if (node.children[childIndex] == null) {
                node.children[childIndex] = new Node();
                node.numChildren++;
            }
            node = node.children[childIndex];
        }

        node.value = value;

    }