Tag quantum algorithms