1

Suppose we have a sequence with n distinct items, $item_0$ ... $item_{n-1}$ and n positions $p_0, ..., p_{n-1}$.

The only restriction is that for $item_i$, it can only appear at its neighbor positions with at most distance of $d$, note that here $d$ is small, generally $d \le 5$. We have for $item_i$, it can appear at $[p_{i-d}, p_{i+d}], 0 \le i-d, i+d\le n$.

I got two questions:

  1. Is there any algorithms that is fast to generate all sequences?
  2. What is the number of all possible sequences?

This question is a simplified version of the question following Permutations with restrictions on item positions

Thank you in advance.

hddmss
  • 111

0 Answers0