search for modified josephus problem. you will get the answer :) On Wed, Feb 9, 2011 at 4:52 PM, punnu <[email protected]> wrote: > Suppose n people are arranged in a circle. Number the people from 1 to > n. in the clockwise order. We are given an integer ,m <= n. Beginning > with the person with designated number 1, we proceed around the circle > (in clockwise order) removing every mth person. After each person is > removed, counting continues around the circle that > remains. This process continues until all the n people have been > removed. . The .m-permutation is defined as the order in which the > people have been removed. As an example, if n = 7, m = 3, then the 3 - > permutation is 3,6,2,7,5,1,4. > Give an O(n log n) time algorithm which given m and n outputs the m- > permutation. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > >
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
