  Quantum algorithms for unstructured search problems rely on the preparation
of a uniform superposition, traditionally achieved through Hadamard gates.
However, this incidentally creates an auxiliary search space consisting of
nonsensical answers that do not belong in the search space and reduce the
efficiency of the algorithm due to the need to neglect, un-compute, or
destructively interfere with them. Previous approaches to removing this
auxiliary search space yielded large circuit depth and required the use of
ancillary qubits. We have developed an optimized general solver for a circuit
that prepares a uniform superposition of any N states while minimizing depth
and without the use of ancillary qubits. We show that this algorithm is
efficient, especially in its use of two wire gates, and that it has been
verified on an IonQ quantum computer and through application to a quantum
unstructured search algorithm.
