سوال ۴۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۲
عبارت منظّم (regular expression) توصیفکننده زبان پذیرنده ماشین متناهی زیر کدام است؟ (منظور از رشته به طول صفر است.)
پاسخ صحیح: گزینهٔ D —
The automaton has a -region ( on input ) and a -region ( fourth state on input ), joined by a connector. Every accepting run reads a block of s and then a block of s and never returns a after a , so the language is exactly
(all strings in which every precedes every ; equivalently, no factor ). The trick is to see which option equals .
Each option has the common shape , where fixes the parity of the -count and fixes the parity of the -count. The bridge supplies the missing single and/or single to reach the other parity class:
| bridge term | meaning | (#0, #1) parity reached |
|---|---|---|
| even s, even s | ||
| odd s, even s | ||
| even s, odd s | ||
| odd s, odd s |
To describe we need all four parity classes, because contains strings with any -count and any -count. Only the bridge supplies all four, so only option 4 works. Indeed
since and , giving after distributing the across the second factor.
The other options each drop a parity class:
- Option 1, : the bridge is mandatory (no ), so , , are missing.
- Option 2, : misses the odd-/odd- class, e.g. .
- Option 3, : keeps only even/even and odd/odd, so and are rejected.
Hence the answer is option 4.
Exam trick: When every choice is , ignore the automaton's exact wiring and classify each candidate by the four parity classes its bridge can reach. The full language needs all four, which singles out .