Related Articles
Moore and Mealy machines to produce ‘A’, ‘B’, ‘C’ depends on inputs that end with ’10’ or with ’11’ else other
• Last Updated : 20 Nov, 2019

Prerequisite: Mealy and Moore Machines, Difference between Mealy machine and Moore machine
Problem: Construction of the machines that take set of all string over {0, 1} as input and produce ‘A’ as output if the input ends with ’10’ or produce ‘B’ as output if the input ends with ’11’ otherwise produce ‘C’ as the output.
Assume,

```Ε = {0, 1} and
Δ = {A, B, C}  ```

where Ε and Δ are the input and output alphabet respectively.

Explanation:
The required Moore machine is constructed below: In the above diagram, the initial state ‘w’ on getting ‘0’ as the input it remains in the state of itself and prints ‘C’ as the output, on getting ‘1’ as the input it transmits to a state ‘X’ and prints ‘C’ as the output so on for the remaining states.

Thus finally above Moore machine can easily produce ‘A’ as output if the input ends with ’10’ or produce ‘B’ as output if the input ends with ’11’ otherwise produce ‘C’

Conversion of Moore machine to Mealy machine:
Above Moore machine takes set of all string over {0, 1} as input and produce ‘A’ as output if the input ends with ’10’ or produce ‘B’ as output if the input ends with ’11’ otherwise produce ‘C’ as the output.
Now we need to transform the above transition diagram of Moore machine to equivalent Mealy machine transition diagram.

Steps for the required conversion are given below:-

• Step-1: Formation of State Transition Table of the above Moore machine- In the above transition table, States ‘W’, ‘X’, ‘Y’ and ‘Z’ are kept in the first column which on getting ‘0’ as the input it transits to ‘W’, ‘Z’, ‘Z’ and ‘W’ states respectively, kept in the second column and on getting ‘1’ as the input it transits to ‘X’, ‘Y’, ‘Y’ and ‘X’ states respectively, kept in the third column and In the fourth column under Δ, there are corresponding outputs of the first column states. In the table, An arrow (→) indicates the initial state.

• Step-2: Formation of Transition Table for Mealy machine from above Transition Table of Moore machine-
Below transition table is going to be formed with the help of the above table and its entries just by using the corresponding output of the states of the first column and placing them in the second and third column accordingly. In the above table, the states in the first column like ‘W’ on getting ‘0’ as the input it goes to a state ‘W’ and gives ‘C’ as the output and on getting ‘1’ as the input it goes to the state ‘X’ and gives ‘C’ as the output and so on for the remaining states in the first column. In the table, An arrow (→) indicates the initial state.

• Step-3: Then finally we can form the state trasition diagram of Mealy machine with help of it’s above transition table.
The required diagram is shown below- Above Mealy machine takes set of all string over {0, 1} as input and produce ‘A’ as output if the input ends with ’10’ or produce ‘B’ as output if the input ends with ’11’ otherwise produce ‘C’ as the output.

Note: While converting from Moore to Mealy machine the number of states remains same for both Moore and Mealy machine but in case of Mealy to Moore conversion it does not give the same number of states.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :
{"ft_lang_label":"__label__en","ft_lang_prob":0.88930565,"math_prob":0.97768795,"size":3307,"snap":"2021-04-2021-17","text_gpt3_token_len":793,"char_repetition_ratio":0.18316682,"word_repetition_ratio":0.295,"special_character_ratio":0.24493499,"punctuation_ratio":0.07515337,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9733292,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,5,null,5,null,5,null,5,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-25T13:49:00Z\",\"WARC-Record-ID\":\"<urn:uuid:9c3de48a-f5c9-45c1-bbf5-1a97a53344cd>\",\"Content-Length\":\"115791\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:655d8205-8e7c-4959-9cae-3e72a33455c9>\",\"WARC-Concurrent-To\":\"<urn:uuid:f4584b41-75ee-49e9-9de4-271d44ca90ca>\",\"WARC-IP-Address\":\"23.199.71.96\",\"WARC-Target-URI\":\"https://www.geeksforgeeks.org/moore-and-mealy-machines-to-produce-a-b-c-depends-on-inputs-that-end-with-10-or-with-11-else-other/?ref=rp\",\"WARC-Payload-Digest\":\"sha1:NC3I466FOGAAT5M3HRCR2EYSVFHC7UHD\",\"WARC-Block-Digest\":\"sha1:S7IYF2Y4PWCKWZPP34RPYRVMMSS4QTLE\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703581888.64_warc_CC-MAIN-20210125123120-20210125153120-00261.warc.gz\"}"}