QI. Find the number n of distinct permutations that can be formed from all the letters of each word: (a) THOSE (b) UNUSUAL (c) SOCIOLOGICAL
close all,
clear all,
clc,
%Find the number n of distinct permutations that can be formed from all the letters of each word: (a) THOSE (b) UNUSUAL (c) SOCIOLOGICAL
v = 'THOSE';
P = perms(unique(v));
fprintf('\n\tNo. of permutations of word %s = %d',v,length(P));
v = 'UNUSUAL';
P = perms(unique(v));
fprintf('\n\tNo. of permutations of word %s = %d',v,length(P));
v = 'SOCIOLOGICAL';
P = perms(unique(v));
fprintf('\n\tNo. of permutations of word %s = %d',v,length(P));
Results:
No. of permutations of word THOSE = 120
No. of permutations of word UNUSUAL = 120
No. of permutations of word SOCIOLOGICAL = 5040
Comments
Leave a comment