In the correct grammar above, what is the length of the derivation (number of steps starting from S) to generate the string albmwithl≠m?
A
l+m+2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
max(l,m)+3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
max(l,m)+2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
l+m+3
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution
The correct option is Cmax(l,m)+2 If grammar generates anb0ora0bn then the length is max (l, m) if it generates albm initially we include two extra derivation so the total length is max(l,m)+2.