public LinkedList<E> toLinkedList()
    {
        LinkedList<E> result = new LinkedList<>();
        if (isEmpty())  return result;
        Queue<Node> q = new Queue<>();
        q.enqueue(root);
        while (!q.isEmpty())
        {
            Node u = q.dequeue();
            result.add(u.key);
            if (u.left != null)   q.enqueue(u.left);
            if (u.right != null)   q.enqueue(u.right);
        }
        return result;
    }