Ex6 4

$\def\abs#1{|#1|}\def\i{\mathbf {i}}\def\ket#1{|{#1}\rangle}\def\bra#1{\langle{#1}|}\def\braket#1#2{\langle{#1}|{#2}\rangle}\def\tr{\mathord{\mbox{tr}}}\mathbf{Exercise\ 6.4}$

a) Define a quantum algorithm that computes the maximum of two $n$-qubit registers.

b) Explain why such an algorithm requires one additional qubit that cannot be reused, i.e., the algorithm will have to have $2n+1$ input and output qubits.