# An unexpected result of the Implementation of a finding minimum values algorithm using a qRAM

Motivated by the article Quantum algorithm for finding minimum values in a Quantum Random Access Memory, I'm training to implement a simplified version of the proposed algorithm. But the output isn't what I expected. Please help me find out what I am doing wrong.

The algorithm idea is to find the minimum value of a data set checking the most significant qubit.

( if the most significant bit is zero, it means that its value is less than the other with the most significant bit equal to one.

ex:

01 -> most significant qubit = 0,

10 -> most significant qubit = 1.

it means 01 < 10.

)

So, using a qRAM to load the data and associate each element to an index, we must use the Grover algorithm to amplify the minimum value index, and then find the minimum value.

So, in the simplified version, I want to find the minimum value between "010" and "101"

$$|00\rangle_{\text{index}} \rightarrow |010\rangle_{\text{data}}$$

$$|01\rangle_{\text{index}} \rightarrow |101\rangle_{\text{data}}$$

so, the algorithm must to amplify the index $$|00\rangle_{\text{index}}$$ that corresponds to the data element $$|010\rangle_{\text{data}}$$. But, in the end, the measurement result is $$01$$ that corresponds to the value $$|101\rangle_{\text{data}}$$.

The figures below show the algorithm circuit and result.