Блог пользователя Gedawy

Автор Gedawy, история, 2 месяца назад, По-английски

How to solve this problem?

find the number of permutations of length N that have longest increasing subsequence equal to K

1<=N<=40 , 1<=K<=5 problem link

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

There's an array (let's call it $$$d$$$) used in the standard algorithm for finding the longest increasing subsequence. We are interested in its first five elements. Recall that the input is a permutation. We see that $$$\mathit{choose} (40, 5) = 658\,008$$$. So perhaps we can devise a dynamic programming solution. The state can be the first five numbers of the array $$$d$$$.