# Theory of Computation: Question Set – 15

#### What is a Mealy machine?

A Mealy machine is a type of finite state machine where the outputs are dependent on both the current state and the inputs. The outputs are produced when the machine transitions from one state to another.

#### What is a Moore machine?

A Moore machine is a type of finite state machine where the outputs are dependent only on the current state. The outputs are produced when the machine enters a particular state.

#### How do you represent a Mealy machine?

A Mealy machine is represented by a directed graph called a state diagram. Each node of the diagram represents a state, and each edge represents a transition between states. The edges are labeled with the input that triggers the transition, as well as the output produced by the transition.

#### How do you represent a Moore machine?

A Moore machine is also represented by a state diagram, where each node represents a state and the edges represent the transitions between states. However, the outputs are associated with the nodes rather than the edges. Each node is labeled with the output produced when the machine is in that state.

#### What is the difference between Mealy and Moore machines?

The main difference between Mealy and Moore machines is when the outputs are produced. In a Mealy machine, the outputs are produced when the machine transitions from one state to another, and they depend on both the current state and the inputs. In a Moore machine, the outputs are produced when the machine enters a particular state, and they depend only on the current state.

#### Which type of machine is easier to implement, Mealy or Moore?

Moore machines are generally easier to implement because they have simpler output functions. In a Mealy machine, the output function depends on both the current state and the inputs, which can make the implementation more complex.

#### Can a Mealy machine be converted to a Moore machine, or vice versa?

Yes, a Mealy machine can be converted to a Moore machine, and vice versa. The conversion involves modifying the output function so that it depends only on the current state (for a Moore machine) or on the current state and inputs (for a Mealy machine). The resulting machine will have the same language as the original machine

#### What is the difference between Mealy and Moore machines in terms of memory usage?

Mealy machines typically use less memory than Moore machines because the output is not stored in each state. In a Moore machine, the output is associated with each state, which requires additional memory.

#### Can Mealy and Moore machines recognize the same languages?

Yes, Mealy and Moore machines can recognize the same languages because they are both types of finite state machines, and any regular language can be recognized by a finite state machine.

#### Can a Mealy machine have the same output for multiple transitions?

Yes, a Mealy machine can have the same output for multiple transitions. The output function is determined by both the current state and the inputs, so it is possible for different transitions to produce the same output.