algorithm - Permutation of all the characters when few characters are always together -


i trying obtain permutation of characters in string lets 'kiran'. can use :

perms('kiran')

this returns permutation of character in string factorial(5)=120. now, looking obtain, permutation of string when characters 'ira' together.

the answer factorial(3) = 6.

i write module returns permutation of characters, 'ira' together.

any idea how programmatically obtain in matlab?

thanks

x={'k','ira','n'} %one permutation per row y=x(perms(1:numel(x))) %concatinate rows y=arrayfun(@(x)[y{x,:}],1:size(y,1),'uniformoutput',false) 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -