Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2012/iii/paper-67/2/c/solution

First use the allowed one-query algorithm to learn exactly. This restricted two-index Boolean quantum oracle is realized by relabelling indices in a single query to the original input. Measure its output and choose the second query classically.
If , the first two bits agree and their common value is the majority, irrespective of . Query and output it. If , the first two bits cancel in the vote, so query and output it. Thus
The exact two-query majority algorithm uses one parity query and one ordinary bit query on every branch, and is correct on all eight inputs. Together with the lower bound this proves .

New to topics? Read the docs here!