3 votes 3 votes There are m variables in a grammar. The number of productions after removal of unit productions in the worst case is ,(Assume there are no null productions) (a) O(m) (b) O(m^2)m2m2) (c) O(k^m)kk^mkm) (d) O(2^m)2 krish__ asked Jun 6, 2016 krish__ 1.0k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Ans (a) m variable can produce maximum m+1 productions srestha answered Jun 6, 2016 srestha comment Share Follow See all 2 Comments See all 2 2 Comments reply krish__ commented Jun 7, 2016 reply Follow Share The worst case scenario has to be considered. That would be definitely more than m+1 productions after removing unit productions ( does not change the number of productions ) since we can have more than one production for a given variable. Eg: S -> ABC A -> B | C B -> C | A C -> A | B We have 3 variables A,B,C and there are 2*m productions just considering A,B and C. 0 votes 0 votes Kaluti commented Aug 31, 2017 reply Follow Share resultant grammar maximum 'm' production , where m is number of variable . example :- S---->A A---->B B---->a/b/c resultant grammar , S---->a/b/c So , it is O(m) time . 0 votes 0 votes Please log in or register to add a comment.