# In HDB3, does a 1 have opposite polarity to the last 1, or to the last V?

I am trying to understand HDB3, and in particular trying to find out whether the picture below which shows the encoding of a bitstring in HDB3 is correct or not:

From what I understand, a 1 will have the opposite polarity to the last 1. So since the red 1 is -, the blue 1 should be +.

But in the picture, the blue 1 is -. Is this correct? Is it because the 0 in black is +?

The diagram is correct. A 1 must have the opposite polarity of the previous pulse, regardless of whether that pulse was part of a 4-zero substitution or another 1.
Otherwise, it would constitute another V, which would be illegal.
• What if the last pulse of the 1 is a 0? So in the above diagram, if we add a 0 between the black 0 and the blue 1, what will the polarity of the blue 1 be?
• That doesn't make any sense. A 1 is never a 0; it is always either + or -. Perhaps this previous question on the topic will help clarify matters. Commented May 31, 2016 at 19:18
• Sorry, by "last pulse", I mean the previous pulse. So again, what would the encoded string be if there is a 0 before the blue 1 and the black 0?