  A prerequisite for many quantum information processing tasks to truly surpass
classical approaches is an efficient procedure to encode classical data in
quantum superposition states. In this work, we present a circuit-based
flip-flop quantum random access memory to construct a quantum database of
classical information in a systematic and flexible way. For registering or
updating classical data consisting of $M$ entries, each represented by $n$
bits, the method requires $O(n)$ qubits and $O(Mn)$ steps. With post-selection
at an additional cost, our method can also store continuous data as probability
amplitudes. As an example, we present a procedure to convert classical training
data for a quantum supervised learning algorithm to a quantum state. Further
improvements can be achieved by reducing the number of state preparation
queries with the introduction of quantum forking.
