A method of performing a Grover's or a Deutsch-Jozsa's quantum algorithm
being input with a binary function defined on a space having a basis of
vectors of n of qubits includes carrying out a superposition operation
over input vectors for generating components of linear superposition
vectors referred to a second basis of vectors of n+1 qubits. An
entanglement operation is performed over components of the linear
superposition vectors for generating components of numeric entanglement
vectors. The method allows a non-negligible time savings because the
entanglement operation does not multiply a superposition vector for an
entanglement matrix, but generates components of an entanglement vector
simply by copying or inverting respective components of the superposition
vector depending on values of the binary function. An interference
operation is performed over components of the numeric entanglement
vectors for generating components of output vectors.