Hi,
Please help me on this one....just tell me some basic algorithm to solve this problem...........
A group of soldiers is surrounded by an overwhelming army force. There is no hope for victory, but there is a single horse to escape. The soldiers agree to a pact to determine which of them is to escape on the horse and summon help. Every soldier writes his name on a piece of paper and drops it in a hat. Then they form a circle. A random number n is selected. A name is picked from the hat. Starting with the soldier whose name is picked, they count clockwise around the circle. The soldier on which the count reaches n is removed from the circle. The count begins from the soldier who sat next to the removed soldier, moving in the clockwise direction. This continues until all but one soldier have been removed. The last soldier takes the horse and escapes.
Required output:
Using the technique used by the soldiers, display the sequence in which the soldiers are eliminated from the circle.
Show which soldier escapes with the horse.
Note:
Input a list of names of soldiers.
There is no restriction on the number of soldiers.
Make a circular list of the names of soldiers.
Generate a random number n, which should be greater than 0 and less than the number of soldiers.
Randomly pick a soldier to start with.
Minimum size for soldier name=10.Also:
Implement it using circular linked list of a structure “node”, which contains a field for name of soldier and a pointer to the next node.