special case of permutation combination with same sequence

1 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2017-1-30
@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 2017-1-30
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.

请先登录,再进行评论。

回答(1 个)

Guillaume
Guillaume 2017-1-30
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{:})

类别

Help CenterFile Exchange 中查找有关 Discrete Math 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by