Igor at rockfest (easy programming puzzle)

0 views
Skip to first unread message

techietone

unread,
Sep 19, 2011, 12:11:41 AM9/19/11
to algocircle
One day Igor goes to attend the rockfest happening at carnegie
auditorium .
After reaching at the venue he is in the queue of people waiting for
their entry tickets.
everybody will get tickets in sequential order starting from the first
person in the row.
But unfortunately his friend Mason who is much ahead of him the in
the ticket row , sends a text message to
him that tickets are going to be sold out when in the row , the
person previous to Igor buys the ticket.
Now igor knows the position of the person standing before him in the
row , he makes a strategy to somehow remove this person from ticket
row., so that he comes into a postion to get a ticket. , still the
people standing behind him dont get disturbed .
he messages his friend Matt who is security officer at the venue to
remove this person .
His friend adheres to what his friend Igor has told him and does a
trick so that Igor gets ticket people standing behind are still in the
row.
what could be Matt's trick . Model the solution to something known


pritesh kumar

unread,
Sep 19, 2011, 10:04:59 AM9/19/11
to algocircle
one more thing is that Igor cant himself move one position ahead so that , the person ahead of him is forced out. 

vishal

unread,
Sep 20, 2011, 4:01:27 AM9/20/11
to algocircle
Ok when can u tell the answer...;)

pritesh kumar

unread,
Sep 20, 2011, 4:31:26 AM9/20/11
to algoc...@googlegroups.com
it can be modeled to deleting a node in a singly linked list , if only that node pointer is given

pritesh kumar

unread,
Sep 20, 2011, 4:33:55 AM9/20/11
to algoc...@googlegroups.com
anyway all arguments to this model solution and problem are welcome !
i just tried to formulate a known problem in terms of some scenario. :) :)

vishal

unread,
Sep 20, 2011, 4:35:46 AM9/20/11
to algocircle
In linked list we replace the node data to the given node and delete
the node that follows....

How abt here and what abt last node....?

vishal

unread,
Sep 20, 2011, 4:36:23 AM9/20/11
to algocircle
sorry no last node can be here....:)

pritesh kumar

unread,
Sep 20, 2011, 4:49:39 AM9/20/11
to algoc...@googlegroups.com
yeah your solution is correct , its like replacing current node data with next node and then deleting next node.
but anyway here igor is always somewhere in the middle .
 
yeah if the node is last this approach fails.

Reply all
Reply to author
Forward
0 new messages