Good Essays
3 Context-Free
Grammar

Answer for Exercises of Chapter 3 (Questions at Page 75, Module:
Introduction to Theory Of Computer Science: Definitions And Examples)
1.
a)

Give a derivation of string ababccddcc.
Derivation
Rule
S  abSc
S  abSc
 ababScc
S  abSc
 ababAcc
SA
 ababccddcc
A  cd

b)

Build the derivation tree for the derivation in part (a).
The derivation tree corresponding to the preceding derivation is
S
a

b

S a b

c
S

c

A c c

A

d

d

c)

Use set notations of (V, , P, S) to define L(G).
L(G) = ({S, A}, {a, b, c, d},{ S → abSc | A; A → cAd | cd}, S}
L(G) = {(ab)ncmdmcn | n  0; m > 0}

a)

Give a leftmost derivation of string aabbba.
Derivation
Rule
S  ASB
S  ASB
 aAbSB
A  aAb
 aaAbbSB
A  aAb
 aabbSB
A
 aabbB
S
 aabbba
B  ba

2.

1|P a g e

3 Context-Free
Grammar
 aabbba

b)

Give a rightmost derivation of string abaabbbabbaa.
Derivation
Rule
S  ASB
S  ASB
 ASbBa
B  bBa
 ASbbaa
B  ba
 AASBbbaa
S  ASB
 AASbBabbaa
B  bBa
 AASbabbaa
B
 AAASBbabbaa
S  ASB
 AAASbabbaa
B
 AAAbabbaa
S
 AAaAbbabbaa
A  aAb
 AAaaAbbbabbaa
A  aAb
 AAaabbbabbaa
A
 AaAbaabbbabbaa A  aAb
 Aabaabbbabbaa A  
 abaabbbabbaa A  
 abaabbbabbaa

c)

Build the derivation tree for the derivations in parts (a) and (b).
S
A

S

a

A

a

A

b

B b a

b

S
A

S

A a B

S

A

b

a

A

S Bb

A b B
B a

 

b

b

B

a a 2|P a g e

3 Context-Free
Grammar
a A

b

d)

Use set notations of (V, , P, S) to define L(G).
L(G) = ({S, A, B}, {a, b},{ S  ASB | ; A  aAb | ; B  bBa | ba}, S}
L(G) = {an1bn1 … ankbnk bm1am1 … bmlaml | ni, mi > 0; k, l  0; k  l}

a)

Give a leftmost derivation of string abbaab.

3.
S  SAB
 SABAB
 λABAB
 λaBAB
 λabBAB

You May Also Find These Documents Helpful

• Good Essays

• 1577 Words
• 7 Pages

INVESTMENT & PORTFOLIO MANAGEMENT FIN3IPM TUTORIAL ANSWERS TUTORIAL 1: INTRODUCTION CHAPTER 1: QUESTION 1 a The process of investment concerns the purchase of assets which will provide a future return to allow for future consumption or further investment. Individuals have to make choices between current and future consumption and because their pattern of income does not always match their pattern of consumption, they are required to make investments. Throughout an individual’s life…

• 1577 Words
• 7 Pages
Good Essays
• Good Essays

• 2171 Words
• 12 Pages

1. What are the factors taken into account by linguists when designing language maintenance and revitalization strategies? Which strategy would you choose for the following languages, and why? a) Cantonese b) Hakka in Hong Kong 2. What are the six major problems identified by Tsunoda that language revitalization faces? 3. In what ways do governments play an essential role in the revitalization of languages? Funding Use and recognition as an official language Promote language by education…

• 2171 Words
• 12 Pages
Good Essays
• Satisfactory Essays

TUTORIAL 4 – DISCRETE DISTRIBUTIONS Question 1 An experiment consists of picking a card at random from a standard deck of cards and replacing it. If this experiment is performed 12 times, what is the probability that you get: (a) exactly 2 aces; (b) exactly 3 hearts; (c) more than 1 heart. Solution Let n = 12, the no of experiments. (a) Let p = probability of obtaining an ace in an experiment of picking a card at random from a standard deck of cards; and = 4/52 = 1/13…

• 552 Words
• 3 Pages
Satisfactory Essays
• Powerful Essays

Tutorial 1- Introduction to Legal Environment of Business 1a) This is a civil matter as it is a private dispute between S and T which is not harmful to society. The dispute should be resolved through mediation. This is because it is cheaper, faster, more informal, and also private. Most importantly, it creates a win-win situation which will allow S and T to preserve their business relationship and compromise to settle the dispute amicably. b) This is a criminal and civil matter. It is criminal…

• 20975 Words
• 60 Pages
Powerful Essays
• Powerful Essays

1 Managerial Economics 2010 Answers to All Tutorial Questions Topic 1 : What is managerial economics Questions from Chapter 1 of the Text (McTaggart, Findlay & Parkin) Review Question 1 (pp. 4) List some examples of scarcity in Australia today. An example of scarcity at the economy-wide level would be people with lower incomes being forced to choose between food and petrol due to high prices for both. An example of scarcity at an individual level would be a person unable to afford both…

• 26249 Words
• 105 Pages
Powerful Essays
• Good Essays

Chapter 8: Planning a Sales Call is a Must TRUE OR FALSE 1. 2. 3. 4. 5. 6. FALSE FALSE TRUE FALSE TRUE TRUE MCQs 1. 2. 3. 4. 5. 6. 7. 8. D D E C A B C D ESSAY QUESTIONS 1. Experienced salespeople guide the customer in the direction of a pre-planned outcome with such simple questions as these:a. If we can meet the spec, can you set up a trial? b. How soon will the VP be available to make a decision? c. Can you schedule a demonstration before the end of the month? 2. Many people do not trust sales…

• 1799 Words
• 11 Pages
Good Essays
• Good Essays

Week 2 – Commencing 5th March 1.3 These three levels of managers require different forms of management accounting information because of the very different nature of the decisions that they make and their different areas of responsibility. For example, senior managers may spend considerable time making strategic decisions for the entire organisation so require information about markets, customers and competitors. They also need to monitor the financial performance of the entire organisation…

• 1400 Words
• 6 Pages
Good Essays
• Satisfactory Essays

1. Which of the following statements about market segmentation is true? A) It involves changing the identity of a product, relative to the identity of competing products, in the collective minds of the target market. B) It is a process of evaluating each segment's attractiveness and selecting one or more to enter. C) It is a process of creating an image or identity of the product in the minds of the target market. D) It is a process of identifying and profiling distinct groups…

• 337 Words
• 2 Pages
Satisfactory Essays
• Powerful Essays

ABDT3214 International Marketing Week 2 Tutorial 1: Introduction to Global Marketing SECTION A: Coursework Briefing SECTION B: Discussion Questions 1. What are the basic goals of marketing? Are these goals relevant to global marketing? Marketing activities represent an organization’s efforts to satisfy customer wants and needs by offering products and services that create value. These goals are relevant in virtually every part of the world; however, when an organization pursues market opportunities…

• 11975 Words
• 45 Pages
Powerful Essays
• Good Essays

ISYS104 Tutorial – week 5 Review Questions 1. What ethical, social, and political issues are raised by information systems? Explain how ethical, social, and political issues are connected and give some examples. Figure 4.1 can be used to answer this question. Information technology has raised new possibilities for behavior for which laws and rules of acceptable conduct have not yet been developed. The introduction of new information technology has a ripple effect, raising new…

• 2197 Words
• 9 Pages
Good Essays