GATE / CS ARCHIVE

GATE CSE 1996 / QUESTION 2.9

Prefixes of equal-count binary strings

Theory of Computation · Other / Mixed Topics · Full GATE CSE 1996 paper

GATE 1996, Q2.9 2 marks · MCQ
Report issue

Other / Mixed Topics

Question 2.9, GATE 1996: Let init(L)={u:uv∈L for some v}. If L is the set of nonempty binary words with equally many 0s and 1s, determine init(L).
Question 2.9, GATE 1996: Let init(L)={u:uv∈L for some v}. If L is the set of nonempty binary words with equally many 0s and 1s, determine init(L).
Tap to enlarge
Your answer
Answer & solution

Answer: B: {0,1}* (no official key was published)

Take any binary word u. If it has more zeros than ones, append exactly enough ones to balance the counts; if it has more ones, append zeros instead. If its counts are already equal and u is nonempty, append ε; if u=ε, append 01 so the resulting balanced word is nonempty. In every case there exists a suffix v with uv∈L, so every binary word is in init(L). Conversely, every prefix of a binary word is binary. The two inclusions prove init(L)={0,1}*, without requiring the prefix itself to have balanced counts.

Original paper, page 4