special case of permutation combination with same sequence

1 visualización (últimos 30 días)
Vishal Sharma
Vishal Sharma el 30 de En. de 2017
Respondida: Guillaume el 30 de En. de 2017
I have a problem of special case of permutation combination From nos from 1 to 30 .
Supposing a permutation combination from vector 1 to 30 is to be formulated Condition is sequence of previous solution should remain same
Supposing we have reached at 3rd step Where we have 4 5 6 numbers selected and we have to select forth number from remaining set numbers, i.e. from 1 – 3 and 7 – 30, so permutation combinations should be such that sequence of previous numbers 4 5 6 should remain same, so the result should be
1 4 5 6
2 4 5 6
3 4 5 6
7 4 5 6
4 1 5 6
......
and so on When we have four digit selected say (e.g.) 4 9 5 6 Next time permutation combinations are to be formulated for fifth digit from remaining set of numbers in the same sequence of 4 9 5 6
Thanks and Regards
  2 comentarios
Stephen23
Stephen23 el 30 de En. de 2017
@Vishal Sharma: What exactly is your question? Or are you just looking for someone to do your homework for you? You do not seem to have put any effort into this at all.
Adam
Adam el 30 de En. de 2017
You need to give a clearer full example of what you are aiming for. I don't see any obvious logic behind the 'result' that you say should happen, other than that initially it just has 4 5 6 repeated after each number until some point and then it just appears arbitrary.
Permutations and combinations are two distinct things though so saying permutation combinations is confusing.

Iniciar sesión para comentar.

Respuestas (1)

Guillaume
Guillaume el 30 de En. de 2017
What you want is not clear. Possibly, it is this:
fullset = 1:30;
currentset = [4 5 6];
setperms = arrayfun(@(n) perms([n, currentset]), setdiff(fullset, currentset), 'UniformOutput', false);
setperms = vertcat(setperms{:})

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by