Discrete Mathematics and Its Applications, Seventh Edition

Published by McGraw-Hill Education
ISBN 10: 0073383090
ISBN 13: 978-0-07338-309-5

Chapter 13 - Section 13.1 - Languages and Grammers - Exercises - Page 856: 15

Answer

Finding a phrase-structure grammar for each of these languages. a) the set of all bit strings containing an even number of 0s and no 1s b) the set of all bit strings made up of a 1 followed by an odd number of 0s c) the set of all bit strings containing an even number of 0s and an even number of 1s d) the set of all strings containing 10 or more 0s and no 1s e) the set of all strings containing more 0s than 1s f ) the set of all strings containing an equal number of 0s and 1s g) the set of all strings containing an unequal number of 0s and 1s

Work Step by Step

a) S → 00S, S → λ b) S → 10A, A → 00A, A → λ c) S → AAS, S → BBS, AB → BA, BA → AB, S → λ, A → 0, B → 1 d) S → 0000000000A,A → 0A,A → λ e) S → AS, S → ABS, S → A, AB → BA, BA → AB, A → 0, B → 1 f) S → ABS, S → λ, AB → BA, BA → AB, A → 0, B → 1 g) S → ABS, S → T , S →U, T →AT , T →A, U →BU, U →B, AB →BA, BA → AB, A → 0, B → 1
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.