Labyrinth:how to find the exit?

I have a list of the rooms(e.x. ((1 2) (2 4) (IN 1) (IN 3) (1 3) (4 5) (5 OUT)),where () means that rooms are connected with each other "IN"-entrance,"OUT"-exit).Would you be so kind to explaine the algorithm ,which can find the exit ?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

we won't do your homework for you

...nor is this question relevant to programming languages.

i don't want you to write me

i don't want you to write me program....I just wanna to explaine(in the words) basic algorithm,which could find the exit..

[Admin]

This question is off-topic for LtU, please see the FAQ.