only first l.....just apply algorithmm...a see the valid sequence...

Dark Mode

Shubham Kumar Gupta
asked
in DS
Jan 17, 2018

624 views
1 vote

0 votes

By applying BFS algorithm

first we enter P in Queue and process it now we add neighbors of P that are Q and R in any order, since all the options have Q as 2nd element first we enqueue Q then R

Queue have |R|Q|

now we process Q and add its neighbors

Queue have |T|R|

process R

queue have |S|M|T|

process T

Queue have |U|N|S|M|

now no new vertex will be added

so PQRTMSNU

first we enter P in Queue and process it now we add neighbors of P that are Q and R in any order, since all the options have Q as 2nd element first we enqueue Q then R

Queue have |R|Q|

now we process Q and add its neighbors

Queue have |T|R|

process R

queue have |S|M|T|

process T

Queue have |U|N|S|M|

now no new vertex will be added

so PQRTMSNU