What are we actually looking for in the answer?

If you need an algo, here it is:
This is a Josephus problem with a slight mod. Instead of shooting the 
neighbour, we shoot the next person to neighbour.
- As in Josephus problem, we consider a circular linked list.
- we do the following till we are left with two persons. (while 
p->next->next != p) [where p-> represents the current element in 
consideration]
 remove the element (p->next->next)
 repeat.

so, there will be two persons left at the end.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/jiVCBudyFV0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to