Some help with a queue

Hi there! I have a small problem with a queue.
N(integer number) individuals wait in a queue at a theatre. The theatre is closed between 9 and 10. Each individual writes the number of the neigbor who
stands in his/her front and back. If there is no such neigbor, then a 0 is used. Find out the queue from the first until the last person when the persons return back to the theatre.

Any suggestion will be greatly appreciated!
Topic archived. No new replies allowed.