DFA String Examples


Design a DFA such a way that
Let string is w, Number of a(w) mod 3 > Number of b(w) mod 3 This means (number of a divisible by 3) should be greater than (number of b divisible by 3).

Answer
You can easily identify that in which number of a is greater than number of b. (by looking digit notation)
Final states = {H, G, F}
Testing you can perform by taking any string which follows the condition in the question
You can design n number of variations with the above approach.
Exercise Design the DFA in which below condition satisfies.
#a mod 3 = 1 and #b mod 3 = 2