#Matlab, 116 bytes
Matlab, 116 bytes
tabulate makes a frequency table. huffmandict takes a list of symbols and probabilities for each symbol, and calculates the code.
t=tabulate(input('')');
d=huffmandict(t(:,1),cell2mat(t(:,3))/100);
for i=1:size(d,1);disp([d{i,1},' ',d{i,2}+48]);end
#Matlab, 116 bytes
tabulate makes a frequency table. huffmandict takes a list of symbols and probabilities for each symbol, and calculates the code.
t=tabulate(input('')');
d=huffmandict(t(:,1),cell2mat(t(:,3))/100);
for i=1:size(d,1);disp([d{i,1},' ',d{i,2}+48]);end
Matlab, 116 bytes
tabulate makes a frequency table. huffmandict takes a list of symbols and probabilities for each symbol, and calculates the code.
t=tabulate(input('')');
d=huffmandict(t(:,1),cell2mat(t(:,3))/100);
for i=1:size(d,1);disp([d{i,1},' ',d{i,2}+48]);end
#Matlab, 116 bytes
tabulate makes a frequency table. huffmandict takes a list of symbols and probabilities for each symbol, and calculates the code.
t=tabulate(input('')');
d=huffmandict(t(:,1),cell2mat(t(:,3))/100);
for i=1:size(d,1);disp([d{i,1},' ',d{i,2}+48]);end