0
$\begingroup$

Is there a quantum circuit (preferably on Quirk as an example) that will enable me to find the maximum from two inputs?

Example

  • input A: 11011
  • input B: 11100

Expected output: 11100

$\endgroup$
2
  • 1
    $\begingroup$ Hi and welcome to Quantum Computing SE. Could you please add more details? How to decide which input is the right one? Is there any function you can use for determination of the expected output? $\endgroup$ Nov 12, 2020 at 7:54
  • $\begingroup$ Maybe this article would be helpful: arxiv.org/abs/quant-ph/9607014 $\endgroup$ Nov 12, 2020 at 7:55

1 Answer 1

1
$\begingroup$

The easiest way is with a temporary comparison to decide which input to copy over:

circuit

If you want it to run without the extra output register, you can instead CSWAP the inputs based on the comparison bit, sorting them. You can't uncompute the comparison bit until you unsort them though.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.