private Node getNode(int key) {
        Node node = root;
        while (node != null) {
            if (key == node.key) {
                return node;
            }

            node = key < node.key ? node.left : node.right;
        }
        return null;
    }