[algogeeks] ORDER OF A PERMUTATION

2013-03-12 Thread Danh Nguyen
We all know that the order of a permutation is the Least Common Multiples of its disjoint cycles' lengths. Also, we know that an involution is a permutation whose order is at most 2. The number of involutions of length n can be obtained from this recurrence relation: F[n] = F[n - 1] + (n - 1)

[algogeeks] Query on a tree again!

2013-01-15 Thread Danh Nguyen
Hi everyone, I'm trying to solve this problem, but I have no idea to begin. I really need some hints for it: - Given a tree of N nodes, and Q queries. (1 <= N, Q <= 100,000) - Each query has 2 arbitrary nodes on th

[algogeeks] A SPOJ problem

2012-07-31 Thread Thanh Danh Nguyen
Can anyone help me out with this problem please? http://www.spoj.pl/problems/MDIGITS1/ I have no idea approaching this problem, please give me instructions, thank you! -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussio