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
Quantum Computing Stack Exchange is a question and answer site for engineers, scientists, programmers, and computing professionals interested in quantum computing. It only takes a minute to sign up.
Sign up to join this communityIs there a quantum circuit (preferably on Quirk as an example) that will enable me to find the maximum from two inputs?
Example
Expected output: 11100
The easiest way is with a temporary comparison to decide which input to copy over:
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.