$A_l\;(l=0,\dots,k-1)$ are quantum algorithms on $F$ with no measurements, $$b_0\in{{\mathbb Z}}[0,2^{m_0}),$$ $$b_l:\prod_{i=0}^{l-1}{{\mathbb Z}}[0,2^{m_i}) \to {{\mathbb Z}}[0,2^{m_l})\quad 
(1\le l \le k-1),$$ where $m_l:=m(A_l)$, and $$\varphi:\prod_{l=0}^{k-1}{{\mathbb Z}}[0,2^{m_l}) \to G.$$ The output of $A$ at input $f\in F$ will be a probability measure $A(f)$ on $G$, defined as follows: First put $$\begin{aligned}
p_{A,f}(x_0,\dots, x_{k-1})&=&
|A_{0,f}(x_0,b_0)|^2 |A_{1,f}(x_1,b_1(x_0))|^2\dots\nonumber\\
&&\dots |A_{k-1,f}(x_{k-1},b_{k-1}(x_0,\dots,x_{k-2}))|^2.\nonumber\end{aligned}$$ Then define $A(f)$ by setting for any subset $C\subseteq G$ $$A(f)(C)=\sum_{{\varphi }(x_0,\dots,x_{k-1})\in C}p_{A,f}(x_0,\dots, x_{k-1}).$$ Let $n_q(A):=\sum_{l=0}^{k-1} n_q(A_l)$ denote the number of queries used by $A$. For more details and background see [@Hei01]. Below we use the term ‘quantum algorithm’, meaning a quantum algorithm with measurement(s). Note that a quantum query on $F$ (respectively, a quantum algorithm from $F$ to $G$) can also be considered as a quantum query on $\mathcal{F}(\Lambda,K)$ (respectively, a quantum algorithm from $\mathcal{F}(\Lambda,K)$ to $G$), and vice versa.

The above definition simplifies essentially for an algorithm with one measurement, which is given by $$A=(A_0,b_0,{\varphi }),\quad A_0=(Q,(U_j)_{j=0}^n).$$ The quantum computation is carried out on $m:=m(Q)$ qubits. For $f\in F$ the algorithm starts in the state $\lg b_0 \rs$ and produces $$\lg \psi_f \rs=U_n Q_f U_{n-1}\dots U_1 Q_f U_0\lg b_0 \rs.$$ Let $$\lg \psi_f \rs=\sum_{i=0}^{2^m-1}a_{i,f}\lg i \rs.$$ Then the output takes the value ${\varphi 