I came across a pseudocode which I am unable to implement because, I am unable to understand it:
i, c := 0,0;
do i ≠ n →
if v = b[i] → c, i := c + 2, i + 1
c = i → c, i, v := c + 2, i + 1, b[i]
c ≠ i ^ v ≠ b[i] → i := i + 1
fi
od
I think that tis pseudocode is about finding the value v which has occurred more than n / 2 times in b[].