use automata theory. draw dfa for divisibility by 3.. On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh <[email protected]>wrote:
> Given an infinite stream of bits with bits being appended at the > highest significant position. Give an algorithm to say whether the > number formed by sequence of bits that had been processed till then , > is divisible by 3 or not ? > > > My sol: > > have a variable sum.......find the sum of bits....whenever u add a bit > do sum+="bit value" ... check whether sum%3==0..... > ....Is my solution ok?? anyother good solutions ?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- SUDHANSHU PANDEY --only fair thing in this world is a chance-- -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
