The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+1 vote

0 votes

0

@Namit Dhupar how will you deal with the extra number generated by moore machine which is the start symbol in A

0

If I understand your question right @Red_devil, the question here is asking for 2's complement of any binary number...

Well, to do that, I learnt a little trick from somewhere, where given a binary number instead of finding a 1's complement and adding a 1 to LSB and then find the answer, what I do is-

1.) Take the given binary number and look at It's LSB

2.) while going from LSB to MSB all the 0's on the LSB as well as the last 1 from the LSB must be kept as it is and rest of the remaining digits should be complemented...

Here, let me show an example

say given binary is 11**100** ----> So 2' compliment will be (00**100) Highlighted digits are unchanged and rest complemented.**

or 111**1** -----> 000**1 (Even if there are no 0's the 1 at the LSB should remain as it is and rest 1's complemented)**

And no matter what and how long number you throw at it, this machine will accept it!

0

@Namit Dhupar i am just asking what will your machine generate if no string is supplied to it.. i.e. epsilon.

0

@ Namit Dhupar yes!! that is what i am asking.. so every thing you generate will have a 0 at LSB how will you overcome this problem please explain.

+1

I gotta be honest buddy, what I did was I originally derived the question in it's Mealy form and then converted it to Moore.

And the asker asked about the number of states which I immediately responded to, though you are right about Prefixes being always printed....

Can I have an (A,$\epsilon$) in the initial state with no transitions and make another state with say (X,0) with 0 as output, and then continue with rest of the automata, but this would make number of states as 4!

and general rule says, for K states in Mealy, there are K+1 states in Moore...

Other than that,What approach do you have in mind?

And the asker asked about the number of states which I immediately responded to, though you are right about Prefixes being always printed....

Can I have an (A,$\epsilon$) in the initial state with no transitions and make another state with say (X,0) with 0 as output, and then continue with rest of the automata, but this would make number of states as 4!

and general rule says, for K states in Mealy, there are K+1 states in Moore...

Other than that,What approach do you have in mind?

- All categories
- General Aptitude 1.6k
- Engineering Mathematics 7.5k
- Digital Logic 3k
- Programming & DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6k
- Compiler Design 2.1k
- Databases 4.2k
- CO & Architecture 3.5k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 584
- Exam Queries 572
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,121 questions

53,242 answers

184,708 comments

70,481 users