I have two problems on permutations which I can´t solve now becuase my knowledge about permutations and the necessary tricks is very poor.(adsbygoogle = window.adsbygoogle || []).push({});

1st:

Find an algorithm that for given natural N (N<=1000), K and given permutation of N elements will find the Kth composition of this permutation in time less or equal to O(N log K).

2nd:

Find an algorithm that fot given natural N (N<=1000) and given permutation of N elements will determine the number of all cycles that the permutation is composed from in time less or equal to O(n).

Can anybody give me some hint related with any of this two problems, I´m mainly confused as to the satisfaction the maximal possible effecienty.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# 2 problems on permutations

**Physics Forums | Science Articles, Homework Help, Discussion**